A Debian-first guide to detecting input designed to trigger shell execution, reviewing targeted application behavior, and reducing command execution risk.
Command injection is an attack that tries to make an application execute unintended operating system commands. It usually happens when user-controlled input is passed unsafely into shell commands, scripts, or system utilities.
Attackers often try separators, shell syntax, or encoded payloads to break out of intended input handling and run their own commands.
;, &&, |, or backticksid, whoami, cat, uname, or curlsudo journalctl -u caddy --since "1 hour ago"
sudo grep -Ei ";|&&|\||`|whoami|id|uname|cat /etc/passwd|curl |wget |bash -c|sh -c" /var/log/caddy/*.log 2>/dev/null | tail -n 100
sudo grep -Ei "\?|cmd=|exec=|ping=|host=|target=|query=" /var/log/caddy/*.log 2>/dev/null | tail -n 100
ps auxf
sudo ss -tpn
sudo journalctl --since "1 hour ago"
sudo ufw deny from <IP_ADDRESS>
# Limit or disable the vulnerable application function while investigating
sudo kill -TERM <PID>
sudo kill -KILL <PID>
# Inspect how user input reaches shell commands, scripts, or utilities
ps auxf
sudo ss -tpn
sudo journalctl --since "24 hours ago"
sudo find /tmp /var/tmp /dev/shm /var/www -type f -mtime -2 2>/dev/null
Recovery means confirming whether the payload stayed a failed probe or whether it caused command execution, child processes, or persistence.
# Do not build shell commands directly from untrusted input
sudo ss -tulnp
sudo ufw status numbered
sudo journalctl -u caddy --since "24 hours ago"
ps auxf
sudo ss -tpn
sudo apt update
sudo apt upgrade
Manual review of logs, processes, and application behavior should come first. Future recommendations may include tooling that improves visibility, but the most important control is avoiding unsafe command execution paths in the first place.
All commands shown are based on Debian-based systems unless otherwise noted.