Saltar al contenido
HackIndex logo

HackIndex

Herramientas

Generador de Bypass de Inyección de Comandos

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

\rA-Z]*$\"">

Consejo: puedes introducir el regex con o sin delimitadores — tanto /patrón/flags como el patrón simple funcionan.

Cómo funciona

Esta herramienta automatiza la búsqueda de payloads de inyección de comandos que superan un filtro regex dado. Genera docenas de variantes ofuscadas de tu comando y prueba cada una contra el regex — en el servidor en PHP, nunca se ejecuta nada.

  1. 1. Introduce tu comando: el comando en bruto a inyectar, p. ej. whoami o cat /etc/passwd.
  2. 2. Pega el filtro regex: cualquier formato: PHP /pattern/flags, Python r"pattern" o re.compile(...), JavaScript new RegExp(...), backtick de Go, o un patrón simple.
  3. 3. Elige el tipo de filtro: los filtros blacklist bloquean la entrada coincidente (el payload NO debe coincidir); los filtros whitelist solo permiten la entrada coincidente (el payload debe coincidir).
  4. 4. Obtén tus bypasses: se devuelve cada payload que supera la condición del filtro, agrupado por técnica, con el SO al que aplica.

Categorías de técnicas de bypass

El generador cubre las siguientes familias de técnicas de bypass para Linux/Bash y 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.

Filtros blacklist vs. whitelist

Blacklist — el payload NO debe coincidir

La aplicación bloquea la entrada cuando el regex coincide. El regex describe el patrón peligroso — p. ej. [;&|`$] o cat|ls|whoami. Un payload no debe activar el regex para pasar.

Común en: PHP preg_match() con die/block al coincidir, guardas Python re.search().

Whitelist — el payload debe coincidir

La aplicación solo procesa la entrada cuando el regex coincide. El regex describe los caracteres permitidos — p. ej. ^[^;\/&A-Z]*$. Un payload debe satisfacer el regex mientras ejecuta un comando.

Común en: validadores de entrada, código fuente CTF, allowlists WAF.

Consejo: si el regex está anclado con ^ y $, casi siempre es una whitelist. La herramienta te avisará si tu selección de modo parece incorrecta.

Formatos de entrada regex admitidos

Pega el regex exactamente como aparece en el código fuente — la herramienta detecta automáticamente el formato, extrae el patrón y los flags, y lo compila en una expresión compatible con PHP.

Idioma / formato Ejemplo
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]+$"

Preguntas frecuentes

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.