Command Injection
OS Command Injections
<?php
if (isset($_GET['filename'])) {
system("touch /tmp/" . $_GET['filename'] . ".pdf");
}
?>app.get("/createfile", function(req, res){
child_process.exec(`touch /tmp/${req.query.filename}.txt`);
})Vulnerable Parameters
?cmd={payload}
?exec={payload}
?command={payload}
?execute{payload}
?ping={payload}
?query={payload}
?jump={payload}
?code={payload}
?reg={payload}
?do={payload}
?func={payload}
?arg={payload}
?option={payload}
?load={payload}
?process={payload}
?step={payload}
?read={payload}
?function={payload}
?req={payload}
?feature={payload}
?exe={payload}
?module={payload}
?payload={payload}
?run={payload}
?print={payload}Detection
Confirm with time command
Basic Payloads
Bypassing Front-End Validation

AND Operator

OR Operator

Operators
Blind OS Command Injection

Blind OS command injection - Redirect output
Blind OS command injection - out of band OAST
WAF
Blacklisted Characters
Identifying Blacklisted Character

Bypassing Space Filters
Bypass Blacklisted Operators
Bypass Blacklisted Spaces

Bypassing Other Blacklisted Characters
Linux

Windows
Character Shifting
Bypassing Blacklisted Commands
Commands Blacklist
Linux & Windows




Linux Only
Windows Only
Advanced Command Obfuscation
Case Manipulation


Reversed Commands

Encoded Commands

Obfuscated Commands
Fuzzing - Cluster bomb






Evasion Tools
Linux (Bashfuscator)
Windows (DOSfuscation)
Payloads
Tools
Interesting Books
Interesting BooksLast updated
