Command Injection Bypass Generator
Enter a command and a regex filter. We'll generate payloads that bypass it.
How it works
This tool automates finding command injection payloads that survive a given regex filter. It generates dozens of obfuscated variants of your command and tests each one against the regex — server-side in PHP, nothing is ever executed.
- 1. Enter your command: the raw command to inject, e.g.
whoamiorcat /etc/passwd. - 2. Paste the regex filter: any format: PHP
/pattern/flags, Pythonr"pattern"orre.compile(...), JavaScriptnew RegExp(...), Go backtick, or a plain pattern. - 3. Choose the filter type: blacklist filters block matching input (payload must NOT match); whitelist filters only allow matching input (payload must match).
- 4. Get your bypasses: every payload passing the filter condition is returned, grouped by technique, with the OS it applies to.
Bypass technique categories
The generator covers the following families of bypass techniques for Linux/Bash and Windows CMD/PowerShell.
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.
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.
Space bypass
Replaces literal spaces with $IFS, ${IFS}, a tab character ($'\t'), brace expansion ({cmd,arg}), or input redirection (cat</etc/passwd).
Slash bypass
Replaces forward slashes using ${HOME:0:1}, ANSI-C $'\x2f', $'\57', or $(printf '\57').
Variable concat
Splits the command across two shell variables (a=wh; b=oami; $a$b) to avoid matching the full keyword in the regex.
Alternative commands
Substitutes blocked commands: cat → less, tac, nl, head, xxd; whoami → id; ls → echo *.
Wildcards / globbing (hint)
Generates c?t and c* variants. These bypass the regex but require the correct binary on the filesystem. Verify manually.
CMD caret obfuscation
Inserts the ^ escape character between chars (w^h^o^a^m^i). CMD ignores ^ and executes the command normally.
CMD quote splitting
Inserts empty double quotes (wh""oami). Functionally identical to the unquoted form in CMD.
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!.
PowerShell backtick
The backtick (`) is a PowerShell escape character silently ignored in identifiers. wh`oami executes as whoami.
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').
PowerShell invoke variants
Uses iex, the & operator, ScriptBlock::Create, or mixed-case IeX without spelling Invoke-Expression.
Blacklist vs. whitelist filters
Blacklist — payload must NOT match
The application blocks input when the regex matches. The regex describes the dangerous pattern — e.g. [;&|`$] or cat|ls|whoami. A payload must not trigger the regex to slip through.
Common in: PHP preg_match() with die/block on match, Python re.search() guards.
Whitelist — payload must match
The application only processes input when the regex matches. The regex describes allowed characters — e.g. ^[^;\/&A-Z]*$. A payload must satisfy the regex while still executing a command.
Common in: input validators, CTF challenge source, WAF allowlists.
Tip: if the regex is anchored with ^ and $, it is almost always a whitelist. The tool will warn you if your mode selection looks wrong.
Supported regex input formats
Paste the regex exactly as it appears in the source code — the tool auto-detects the format, extracts the pattern and flags, and compiles it to a PHP-compatible expression.
| Language / format | Example |
|---|---|
| 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.