Command Injection

Injection Operator

Injection Character

URL-Encoded Character

Executed Command

Semicolon

;

%3b

Both

New Line

\

%0a

Both

Background

&

%26

Both (second output generally shown first)

Pipe

`

<<<`

%7c

AND

&&

%26%26

Both (only if first succeeds)

OR

`

`

Sub-Shell

````

%60%60

Both (Linux-only)

Sub-Shell

$()

%24%28%29

Both (Linux-only)

tabulador

\

%09

Linux-only

space

``

${IFS}

Linux-only

If the error message displayed a different page, with information like our IP and our request, this may indicate that it was denied by a WAF

Environment Variables

Linux

${IFS}

Commonly use to evade space

Linux

${PATH:0:1}

/

Linux

${LS_COLORS:10:1}

;

Windows

%HOMEPATH:~6,-11%

/

PowerShell

$env:HOMEPATH[0]

/

Bypassing Blacklisted Commands

Case manipulation

Linux is case-sensitive hance we have to get a bit creative and find a command that turns the command into an all-lowercase word.

Reversing commands

Encode Commands

Blind OS command injection with out-of-band data exfiltration

Miscelaneous commands

Injection Type

Operators

SQL Injection

' , ; -- /* */

Command Injection

; &&

LDAP Injection

* ( ) & `

XPath Injection

' or and not substring concat count

OS Command Injection

; & `

Code Injection

' ; -- /* */ $() ${} #{} %{} ^

Directory Traversal/File Path Traversal

../ ..\\\\ %00

Object Injection

; & `

XQuery Injection

' ; -- /* */

Shellcode Injection

\\x \\u %u %n

Header Injection

\ \\r\ \ %0d %0a %09

Tools

https://github.com/Bashfuscator/Bashfuscator

https://github.com/danielbohannon/Invoke-DOSfuscation

Last updated