When mail-queue spike is not the symptom, web traffic is. Sudden 10x traffic to a single PHP file that did not exist last week. A spike of POST requests to a path you do not recognize. User agents containing “Mozilla/4.0 (compatible; MSIE 6.0)” from a customer who has no IE6 users. These are the signs of a webshell being driven.
What’s happening
A compromised account often hosts a webshell (a PHP file that takes commands via HTTP and executes them). Attackers drive the shell from a botnet, leaving fingerprints in the access log: requests to unknown filenames, large POST bodies, repeating User-Agents from disparate IPs, requests that return 200 OK but for filenames a clean site has never served.
How to verify
ls -lt /home/<user>/public_html/ | head -20
find /home/<user>/public_html/ -mtime -7 -type f -name "*.php" | head
awk '{print $7}' /etc/apache2/logs/access_log | sort | uniq -c | sort -rn | head -20
awk '$9=="200" && $7~/\.php/ {print $7}' /etc/apache2/logs/access_log | sort | uniq -c | sort -rn | head
grep -lrE "eval\(base64_decode|gzinflate|str_rot13|preg_replace.*\\\\e" /home/<user>/public_html/ 2>/dev/null
The first two show new PHP files. The third and fourth show top-requested URLs — a real site has 20–50 unique URLs in the top, a compromised one has one PHP file getting hammered. The grep finds common webshell obfuscation patterns.
The fix
- Sort recently-modified PHP files in the account:
find /home/<user>/public_html/ -mtime -30 -type f -name "*.php" -newer /tmp/cleanmarker. The unfamiliar names are suspects. - Cross-reference with the access log: the top-requested PHP files that the customer cannot identify are probably the webshell.
- Open the file and look for obfuscation:
eval(base64_decode(...)),gzinflate(...),str_rot13,preg_replacewith the/emodifier (deprecated but still found). Genuine code rarely has these. - Suspend the account using the postmortem-friendly workflow. Preserve evidence.
- Find the entry point: webshells are dropped via an exploited plugin (WordPress is the usual suspect), a stolen FTP/SSH credential, or a poorly-coded upload form. Check WordPress’s
wp_audit_logif installed, check FTP transfer logs (/var/log/messageson cPanel withpure-ftpd), check SSH logs. - Clean-room restore: see the defacement clean-room article in this series. Do not try to “remove the webshell and call it done” — there are usually multiple persistence mechanisms.
- Imunify360 if available: run a full scan with Proactive Defense on. It will catch most webshells the file scanner missed.
- Forward: harden the entry point. WordPress: 2FA, latest core, audit plugin list, disable file editing in admin. FTP: disable in favor of SFTP, key-based.
Stack Harbor handles compromise detection and clean-room restores under cPanel/WHM management.