Ga naar content
HackIndex logo

HackIndex

Tools

Command Injection Bypass Generator

Enter a command and a regex filter. We'll generate payloads that bypass it.

\rA-Z]*$\"">

Tip: je kunt de regex met of zonder scheidingstekens invoeren — zowel /patroon/vlaggen als gewoon patroon werkt.

Hoe het werkt

Deze tool automatiseert het vinden van command injection-payloads die een gegeven regex-filter overleven. Het genereert tientallen versluierde varianten van je commando en test elk tegen de regex — server-side in PHP, er wordt nooit iets uitgevoerd.

  1. 1. Voer je commando in: het ruwe commando om in te voegen, bijv. whoami of cat /etc/passwd.
  2. 2. Plak het regex-filter: elk formaat: PHP /pattern/flags, Python r"pattern" of re.compile(...), JavaScript new RegExp(...), Go backtick, of een gewoon patroon.
  3. 3. Kies het filtertype: blacklist-filters blokkeren overeenkomende invoer (payload mag NIET overeenkomen); whitelist-filters staan alleen overeenkomende invoer toe (payload moet overeenkomen).
  4. 4. Ontvang je bypasses: elke payload die aan de filtervoorwaarde voldoet wordt teruggegeven, gegroepeerd op techniek, met het OS waarop het van toepassing is.

Bypass-techniekeencategorieën

De generator dekt de volgende families van bypass-technieken voor Linux/Bash en Windows CMD/PowerShell.

Linux

Encoding (base64 / hex / xxd / octal)

Encodes the entire command using base64 (subshell and pipe-to-sh), raw hex decoded by xxd -r -p, printf \x escapes (lowercase), and ANSI-C $'\x..' quoting. Lowercase-only variants bypass [A-Z] filters.

Linux

Quote splitting

Inserts empty single quotes, double quotes, or backslash escapes inside the keyword, e.g. c''at or c\at, breaking pattern matching without changing shell semantics.

Linux

Space bypass

Replaces literal spaces with $IFS, ${IFS}, a tab character ($'\t'), brace expansion ({cmd,arg}), or input redirection (cat</etc/passwd).

Linux

Slash bypass

Replaces forward slashes using ${HOME:0:1}, ANSI-C $'\x2f', $'\57', or $(printf '\57').

Linux

Variable concat

Splits the command across two shell variables (a=wh; b=oami; $a$b) to avoid matching the full keyword in the regex.

Linux

Alternative commands

Substitutes blocked commands: cat → less, tac, nl, head, xxd; whoami → id; ls → echo *.

Linux

Wildcards / globbing (hint)

Generates c?t and c* variants. These bypass the regex but require the correct binary on the filesystem. Verify manually.

Windows

CMD caret obfuscation

Inserts the ^ escape character between chars (w^h^o^a^m^i). CMD ignores ^ and executes the command normally.

Windows

CMD quote splitting

Inserts empty double quotes (wh""oami). Functionally identical to the unquoted form in CMD.

Windows

CMD variable tricks

Splits across environment variables (set a=wh& set b=oami& call %a%%b%). Also supports delayed expansion via cmd /V:ON and !var!.

Windows

PowerShell backtick

The backtick (`) is a PowerShell escape character silently ignored in identifiers. wh`oami executes as whoami.

Windows

PowerShell encoding

Encodes as UTF-16LE base64 for powershell -enc, or rebuilds from a char array ([char[]](119,104,...) -join '') or string concat ('wh'+'oami').

Windows

PowerShell invoke variants

Uses iex, the & operator, ScriptBlock::Create, or mixed-case IeX without spelling Invoke-Expression.

Blacklist- vs. whitelist-filters

Blacklist — payload mag NIET overeenkomen

De applicatie blokkeert invoer wanneer de regex overeenkomt. De regex beschrijft het gevaarlijke patroon — bijv. [;&|`$] of cat|ls|whoami. Een payload mag de regex niet activeren om er doorheen te glippen.

Veelgebruikt in: PHP preg_match() met die/block bij overeenkomst, Python re.search() guards.

Whitelist — payload moet overeenkomen

De applicatie verwerkt invoer alleen wanneer de regex overeenkomt. De regex beschrijft toegestane tekens — bijv. ^[^;\/&A-Z]*$. Een payload moet aan de regex voldoen en toch een commando uitvoeren.

Veelgebruikt in: invoervalidators, CTF-broncode, WAF-allowlists.

Tip: als de regex verankerd is met ^ en $, is het bijna altijd een whitelist. De tool waarschuwt je als je modusselectie niet klopt.

Ondersteunde regex-invoerformaten

Plak de regex precies zoals deze in de broncode staat — de tool detecteert automatisch het formaat, extraheert het patroon en de vlaggen, en compileert het naar een PHP-compatibele expressie.

Taal / formaat Voorbeeld
PHP / JS / Ruby / Perl /[;&|`$\s]/i
Plain pattern ^[0-9a-z]+$
Python raw string r"^[^;/\&.<>\rA-Z]*$"
Python re.compile re.compile(r"[;&|]", re.IGNORECASE)
JavaScript new RegExp new RegExp("[;&|]", "gi")
Go raw string `^[a-z0-9]+$`
Perl m// m/[;&|]/gi
Quoted string "^[a-z0-9]+$"

FAQ

Does this actually execute commands?

No. Everything runs server-side in PHP. Payloads are generated as strings and tested against your regex with preg_match(). No command is ever executed on the server.

What does "payload must match / must NOT match" mean?

A blacklist blocks input when the regex matches: payload must NOT match. A whitelist only allows input when the regex matches: payload must match. The tool auto-detects which is more likely and warns you if your selection looks wrong.

Why are some payloads marked with a warning?

Wildcard and glob-based payloads (e.g. /bin/c?t) depend on the filesystem layout of the target. They bypass the regex filter, but will only work if the expected binary is present at that path.

Why does my ANSI-C quoting payload not run directly?

An ANSI-C string like $'\x77\x68\x6f\x61\x6d\x69' evaluates to the literal string whoami in bash but does not execute it on its own. Prefix it with eval or bash -c, which are lowercase letters and unlikely to be filtered.

Can I use this for CTF challenges?

Yes. This tool is designed for CTF and authorised penetration testing scenarios where you need to bypass an input filter to achieve command execution. Only use it on systems you own or have explicit permission to test.