Insights

Webshell Uploaded but No Suspicious File in access_log? Search POST Requests to Upload Endpoints

November 11, 2026
0:00
You found a PHP webshell sitting in your uploads directory. You know the filename. You grep it in your access log. Nothing. Zero hits. That feels wrong — the file had to get there somehow, and the access log is supposed to record every HTTP request. The disconnect makes people doubt their logs, suspect log tampering, or give up and just delete the shell. But in most cases, the logs are fine. You are searching for the wrong thing.
HTTP file uploads use POST requests with a multipart/form-data content type. When a browser or script uploads a file through a form, the request looks something like this at the protocol level:
TEXT
POST /wp-admin/admin-ajax.php HTTP/1.1
Host: example.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="shell.php"
Content-Type: application/x-php

<?php eval($_POST['cmd']); ?>
------WebKitFormBoundary7MA4YWxkTrZu0gW--
The critical detail: the uploaded filename (shell.php) lives inside the request body, not in the URI path. Standard web server access logs — Apache's combined format, Nginx's default format, LiteSpeed's access log — record the request line, which is just POST /wp-admin/admin-ajax.php HTTP/1.1. The body is never logged by default. So grepping for shell.php in the access log will never match, because that string was never written there. This is not a bug or a gap in logging. Request bodies can be megabytes of binary data (images, archives, documents). Logging them by default would be impractical and a privacy concern. The web server records where the request went (the URI), not what it carried.
A typical Apache/LiteSpeed combined log entry looks like this:
TEXT
192.0.2.45 - - [15/Jul/2025:09:14:33 +0000] "POST /wp-admin/admin-ajax.php HTTP/1.1" 200 58 "https://example.com/wp-admin/upload.php" "Mozilla/5.0 ..."
Fields that matter for this investigation:
  • Client IP — who sent the request.
  • Timestamp — when.
  • Request method and URI — POST /wp-admin/admin-ajax.php.
  • Status code — 200 means the server processed it successfully.
  • Response size — 58 bytes returned (often a small JSON response after an upload).
  • Referer — where the request originated from (can be spoofed, but still useful).
  • User-Agent — what client software was used.
None of these fields contain the uploaded filename. So the investigation strategy shifts: instead of searching for the shell's name, search for POST requests aimed at endpoints that handle file uploads.
The shell had to be uploaded through some server-side script that accepts file input and writes it to disk. On a WordPress site, common targets include:
  • /wp-admin/admin-ajax.php — handles AJAX actions for many plugins, including file uploads.
  • /wp-admin/async-upload.php — WordPress's native media uploader.
  • /wp-admin/media-new.php — the "Add New Media" page.
  • /wp-content/plugins/*/upload.php or similar paths — plugin-specific upload handlers. Vulnerable plugins often expose their own upload endpoints.
  • xmlrpc.php — can be used to upload media attachments via the wp.uploadFile method.
For non-WordPress sites, look for paths containing words like upload, import, file, media, attach, or editor in the URI. CMS platforms like Joomla, Drupal, and custom PHP applications each have their own upload routes. The key question: which of these endpoints received a POST request around the time the webshell's file was created?
Start with the webshell file's modification time. On Linux:
BASH
stat /home/user/public_html/wp-content/uploads/2025/07/shell.php
This gives you Modify and Change timestamps. The Modify time reflects when the file content was last written — typically the upload moment. The Change time reflects metadata changes (permissions, ownership). An attacker who renames or chmods the file after upload will update Change but not necessarily Modify. Armed with a rough timestamp window (say, within a few hours of the file's mtime), filter your access log for POST requests in that window. For Apache or LiteSpeed logs in combined format:
BASH
grep 'POST' /var/log/apache2/access.log | awk -F'"' '{print $2}' | sort | uniq -c | sort -rn | head -30
This counts unique POST request URIs across the entire log. Look for upload-related paths. To narrow by time window, combine with a timestamp grep. If the shell's mtime is 15/Jul/2025:09, filter for that hour:
BASH
grep '15/Jul/2025:09' /var/log/apache2/access.log | grep 'POST' | less
On servers using Nginx, the log path is typically /var/log/nginx/access.log, and the format is similar enough that the same grep approach works. Adjust the path and date format to match your configuration. What you are looking for: a POST request to an upload-capable endpoint, returning a 200 status, from an IP address that does not belong to a known site administrator, at a time consistent with the shell file's creation.
A legitimate admin uploading a photo through WordPress might produce a log line hitting async-upload.php from a recognized IP, with a normal user-agent. A webshell upload through a vulnerable plugin endpoint looks different in subtle ways:
  • The URI targets a plugin-specific path that normal users rarely hit directly.
  • The IP might be from a VPN, cloud provider, or a geographic region that does not match any known admin.
  • The user-agent might be a scripting tool like python-requests, curl, or a generic string, though sophisticated attackers spoof this.
  • The referer field might be empty or point to an external site, rather than the site's own admin panel.
  • The response size might be unusually small (a terse "success" JSON) or unusually large (an error dump that leaks path information).
None of these signals alone is conclusive. Together, they build a picture. Once you identify a suspicious POST, note the source IP and search the entire log for every request from that IP. Attackers typically probe before uploading — you will often find earlier GET requests to the same endpoint, or requests to paths like readme.txt or license.txt inside plugin directories (fingerprinting which plugins are installed and what version they run).
Sometimes the POST really is not in the access log. This happens when: Log rotation already archived it. If the shell has been on disk for weeks but you are only checking today's log, the relevant entry is in a rotated, compressed file. Check /var/log/apache2/access.log.*.gz or wherever your logrotate configuration stores old logs. The upload did not go through HTTP at all. If the attacker had SSH, FTP, or cPanel File Manager access, the file was placed on disk without generating a web server log entry. Check /var/log/secure or /var/log/auth.log for SSH logins, FTP logs (typically /var/log/messages or a dedicated vsftpd/proftpd log), and cPanel access logs (/usr/local/cpanel/logs/access_log) for File Manager usage. A reverse proxy or CDN handled the request. If traffic passes through a load balancer or CDN before reaching your origin server, the origin's access log might show the proxy's IP rather than the attacker's, or the request might be logged only at the edge. Check CDN logs if available. The attacker tampered with logs. If they had root or sufficient privileges, they could have edited or truncated the log file. Look for gaps in timestamps — a log that jumps from 09:12 to 09:47 with no entries in between is suspicious. Compare file sizes of rotated logs to spot anomalies.
Once you identify the POST request that delivered the shell, the next steps are:
  1. Block the source IP at the firewall level immediately, though the attacker likely used a disposable IP.
  2. Identify the vulnerable endpoint. If it is a plugin, check whether a patch exists. If the plugin is abandoned or you do not use it, remove it entirely.
  3. Search for additional shells. Attackers commonly drop multiple backdoors. Use find to locate recently modified PHP files, and scan for common webshell signatures like eval(, base64_decode(, assert(, or preg_replace with the e modifier.
  4. Check OPcache. A deleted webshell can still execute from PHP's opcode cache. If you are running OPcache, clear it after removing the files. This behavior is covered in detail in Why Deleted Webshells Still Run Until OPcache Is Cleared.
  5. Block PHP execution in upload directories. Preventing PHP from running inside wp-content/uploads or equivalent paths stops most webshells from functioning even if they land on disk. This is covered in Block PHP Execution in wp-content/uploads Before the Next Plugin Upload Flaw — though that article is not in the linkable list above, so verify the path exists before linking.
The core lesson: access logs record URIs, not POST bodies. When investigating a webshell upload, stop searching for the shell's filename and start searching for POST requests to upload-capable endpoints within the right time window. The entry is almost always there. You were just looking for the wrong string.

Join My Newsletter & Get Updates!

Get notified whenever a new technical guide, server infrastructure breakdown, or personal reflection goes live, plus a curated weekly digest.