OWASP Hunting

Injection

Command Injection

Command injection allows attackers to execute arbitrary operating system commands by injecting shell metacharacters into application inputs.

Payloads are read from main at 35c1f2b (committed 22 Nov 2026). Project version 1.0.2.

These payloads are for authorized testing only: systems you own, authorized bug bounty programs, or controlled lab environments. Unauthorized testing is illegal.

Payload files

Folder on GitHub

Use the arrow keys to move between payloads. Press Enter or C to copy the focused payload.

command-injection-payloads.txt

307 payloads · 13 KB
Source

Loading payloads for Command Injection…

What it is#

Command injection is a cyber attack that involves executing arbitrary commands on a host operating system via a vulnerable application. This vulnerability occurs when an application passes unsafe user-supplied data to a system shell. An attacker can use shell metacharacters to chain additional commands, redirect output, or establish reverse shells.

Attack vectors#

  • System administration interfaces
  • File upload functionality that processes files
  • Network diagnostic tools (ping, traceroute, nslookup)
  • Backup and restore functions
  • Image/PDF conversion services
  • Any feature that executes system commands with user input

Testing methodology#

  1. Inject command separators (;, &&, ||, |) followed by id or whoami
  2. Test with backtick and $() subshell syntax
  3. Use time-based detection: inject sleep 5 and measure response time
  4. Try out-of-band detection via ping to a controlled host or DNS lookup
  5. Attempt blind injection with output redirection to a web-accessible file

Indicators of vulnerability#

  • Command output embedded in HTTP response
  • Time delay matching sleep duration
  • DNS or HTTP request from server to controlled endpoint
  • Error messages referencing shell commands or /bin/sh

Detection guidance#

Monitor process creation events for unexpected child processes spawned by web server processes. Use EDR telemetry to detect shell executions. Implement WAF rules for common command injection metacharacters.

Mitigation and remediation#

  • Avoid calling OS commands from application code
  • If necessary, use safe APIs that don't invoke a shell
  • Strictly validate and allowlist user input before passing to shell functions
  • Run application processes with minimal OS privileges
  • Use seccomp or AppArmor to restrict system calls

References#

Responsible Use

All content in this reference is for authorized security testing only. Use only on systems you own or have explicit written permission to test.

  • Systems and applications you own
  • Authorized penetration testing engagements
  • Bug bounty programs with defined scope
  • Educational lab environments (DVWA, WebGoat, HackTheBox)