A Debian-first guide to spotting outbound shell activity, suspicious connections, unusual parent-child process chains, and likely callback behavior.
A reverse shell is a shell or command session initiated from the victim system back to an attacker-controlled host. Instead of the attacker directly logging in, the compromised system connects outward and hands over command access.
Reverse shells are common in post-exploitation scenarios because outbound connections are often easier to establish than inbound access.
bash, sh, python, perl, or nc connected to a remote IPsudo ss -tpn
ps aux | grep -E "nc |ncat|netcat|bash -i|/dev/tcp|python|perl|php|socat"
ps auxf
A reverse shell often stands out when a web server, script, or service launches a shell unexpectedly.
sudo readlink -f /proc/<PID>/exe
sudo tr '\0' ' ' < /proc/<PID>/cmdline; echo
sudo ls -lah /proc/<PID>/cwd
sudo journalctl --since "1 hour ago"
sudo ufw deny out to <IP_ADDRESS>
sudo kill -TERM <PID>
sudo kill -KILL <PID>
sudo systemctl stop <service_name>
sudo systemctl disable <service_name>
If the shell came from a web application or service account, contain the origin too.
ps auxf
crontab -l
sudo crontab -l
sudo systemctl list-units --type=service --state=running
sudo find /tmp /var/tmp /dev/shm /var/www -type f -mtime -2 2>/dev/null
sudo grep "Accepted" /var/log/auth.log
sudo grep "sudo" /var/log/auth.log
A reverse shell is a strong sign of compromise. Recovery should include checking persistence, reviewing web content or launched scripts, and validating that no new users, cron jobs, or services were created.
Reverse shells usually happen after another weakness is exploited. Prevention is about reducing code execution paths and limiting egress where practical.
sudo ss -tulnp
sudo systemctl list-units --type=service --state=running
sudo ss -tpn
sudo find /tmp /var/tmp /dev/shm /var/www -type f 2>/dev/null | less
sudo apt update
sudo apt upgrade
sudo ufw status numbered
Manual review comes first. Future recommendations may include low-cost infrastructure or monitoring options that help surface suspicious outbound behavior faster, but the core response remains command-driven.
All commands shown are based on Debian-based systems unless otherwise noted.