Command injection permits the execution of arbitrary OS commands by an attacker on the server hosting an application, potentially fully compromising the application and its data.
Basic Payloads
Context Escaping
Depending on where your input is injected, you may need to terminate the quoted context first:
Top Vulnerable Parameters
Node.js child_process.exec vs execFile
exec() spawns a shell (/bin/sh -c), so any shell metacharacters in user input result in command injection. Always use execFile() or spawn() with separate argument arrays.
Real-world case: Synology Photos ≤ 1.7.0-0794 was exploitable via a WebSocket event placing attacker-controlled data into an exec() call (Pwn2Own Ireland 2024).
Argument/Option Injection via Leading Hyphen
Not all injections require shell metacharacters. If untrusted strings are passed as arguments to system utilities (even with execFile), programs parse - and -- arguments as options:
Bash Arithmetic Evaluation Injection
RewriteMap helpers in bash using arithmetic contexts ([[ $a -gt $b ]], $((...)), let) re-expand variables:
JVM Diagnostic Callbacks for Guaranteed RCE
Any primitive that lets you inject JVM command-line arguments can be turned into reliable RCE:
Because these diagnostics are parsed by the JVM itself, no shell metacharacters are required.
Blind Exfiltration
Time-Based
DNS Exfiltration
Tools: dnsbin.zhack.ca, pingb.in
Filter Bypasses
PaperCut NG/MF Auth Bypass → Print Scripting RCE
Real-World Examples
Resources