☼
⌃
☰

Web Attack Forensics Web Attack Forensics

Table of Contents

Related: windows client DFIR DFIR Webshell [[Denote query for ‘20260613T000006’]] Windows Event Logs

1. Evidence Sources

In order of investigation priority:

  1. Web server access logs — every HTTP request: source IP, timestamp, method, URI, status code, bytes, user agent
  2. Web server error logs — application errors, often reveal attempted exploits that partially failed
  3. Application logs — framework-level events, authentication attempts, database errors
  4. OS and system logs — process execution spawned by the web server process, file system changes, user logins

2. Web Server Log Formats

Apache / Nginx — Combined Log Format

<IP> - <user> [<timestamp>] "<method> <uri> <protocol>" <status> <bytes> "<referer>" "<user-agent>"

192.168.1.5 - - [15/Dec/2025:10:30:45 +0000] "GET /index.php HTTP/1.1" 200 1234 "-" "Mozilla/5.0"

IIS — W3C Extended Log Format

# Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version sc-status sc-bytes
2025-12-15 10:30:45 10.0.0.1 GET /index.aspx - 443 - 192.168.1.5 HTTP/1.1 200 1234

IIS log location: C:\inetpub\logs\LogFiles\W3SVC1\

3. Attack Signatures in Logs

SQL Injection

# URL-encoded payloads in GET parameters
GET /search?q=%27+OR+1%3D1--  HTTP/1.1        ← ' OR 1=1--
GET /page?id=1+UNION+SELECT+NULL,NULL--  HTTP/1.1
GET /page?id=1;DROP+TABLE+users--  HTTP/1.1

# Signs of successful blind SQLi — timing differences
# Many requests to same endpoint with slightly varied parameters
# Unusually long response times on some requests

Webshell Upload and Execution

The key pattern: a POST to an upload endpoint followed within seconds by a GET to the newly created file with a command parameter.

# Upload
192.168.1.5 - - [15/Dec/2025:10:30:45 +0000] "POST /upload.php HTTP/1.1" 200 15
# Execution — 5 seconds later
192.168.1.5 - - [15/Dec/2025:10:30:50 +0000] "GET /images/shell.php?cmd=whoami HTTP/1.1" 200 12

# IIS equivalent
2025-12-15 10:30:45 POST /upload.aspx - 443 - 192.168.1.5 HTTP/1.1 200 15
2025-12-15 10:30:50 GET /uploads/shell.aspx cmd=whoami 443 - 192.168.1.5 HTTP/1.1 200 12

Follow-up: check OS logs for process execution by the web server account (IUSR, IIS APPPOOL\DefaultAppPool, www-data).

Directory Traversal and LFI

GET /page?file=../../../../windows/system32/drivers/etc/hosts HTTP/1.1
GET /page?file=..%2F..%2F..%2Fetc%2Fpasswd HTTP/1.1
GET /page?template=%2e%2e%2f%2e%2e%2fwindows%2fwin.ini HTTP/1.1

IDOR / BOLA — Sequential Enumeration

# Authenticated user cycling through IDs they should not access
GET /api/users/1001 HTTP/1.1  200
GET /api/users/1002 HTTP/1.1  200
GET /api/users/1003 HTTP/1.1  200
GET /api/users/1004 HTTP/1.1  200

# All from same IP, same session token, sequential IDs
# Response size consistent — data returned for each

Scanning and Reconnaissance

# High volume of 404s from same IP in short time window
# Directory brute-forcing pattern
192.168.1.5 - - [15/Dec/2025:10:00:01] "GET /admin HTTP/1.1" 404
192.168.1.5 - - [15/Dec/2025:10:00:01] "GET /backup HTTP/1.1" 404
192.168.1.5 - - [15/Dec/2025:10:00:01] "GET /config HTTP/1.1" 404

# Tool signatures in User-Agent field
"sqlmap/1.7"
"Nikto"
"Mozilla/5.0 (compatible; Googlebot"    ← fake bot
"python-requests/2.28"                  ← automated tool

Brute Force / Credential Stuffing

# Many POST requests to login endpoint, same IP, 401 responses
192.168.1.5 - - [15/Dec/2025:10:00:01] "POST /login HTTP/1.1" 401
192.168.1.5 - - [15/Dec/2025:10:00:02] "POST /login HTTP/1.1" 401
# Followed by a 200 — successful login
192.168.1.5 - - [15/Dec/2025:10:00:15] "POST /login HTTP/1.1" 200

Cross-reference with Windows Security Event 4648 / 4624 if the web application authenticates against Active Directory.

4. Post-Exploitation Indicators in OS Logs

After confirming initial access via web logs, check OS-level evidence of what happened next.

IIS / Windows Server

# IIS worker process (w3wp.exe) spawning cmd.exe or PowerShell
# Check Windows Security log and Sysmon if deployed

# Event 4688 — process creation (if auditing enabled)
# Look for: w3wp.exe → cmd.exe, powershell.exe, whoami.exe

# Files created in web root — check timestamps
# C:\inetpub\wwwroot\ — new .aspx, .php, or .exe files
dir /tc C:\inetpub\wwwroot\         ← sort by creation time

File System Integrity

Check for new or modified files in the web root around the time of the incident:

SHELL
# Windows — files created in last N days in web root
forfiles /p C:\inetpub\wwwroot /s /d -1 /c "cmd /c echo @path @fdate @ftime"

# Hash all files in web root and compare to baseline
Get-ChildItem -Recurse C:\inetpub\wwwroot | Get-FileHash | Export-Csv hashes.csv
# Compare against known-good baseline hashes

5. Log Analysis Workflow

SHELL
# Extract all requests from a specific IP
grep "192.168.1.5" access.log

# Find all POST requests (uploads, form submissions)
grep "POST" access.log | grep " 200 "

# Find requests to newly discovered webshell
grep "shell.php\|shell.aspx" access.log

# Find scanning — IPs with high 404 count
awk '{print $1, $9}' access.log | grep 404 | sort | uniq -c | sort -rn | head -20

# Find all unique IPs that POSTed successfully
awk '$6 == "\"POST" && $9 == "200"' access.log | awk '{print $1}' | sort -u

# Extract requests in time window
awk -F'[' '$2 >= "15/Dec/2025:10:00:00" && $2 <= "15/Dec/2025:11:00:00"' access.log

# IIS log — find all non-200 responses
Select-String -Path "*.log" -Pattern " [45][0-9][0-9] "

# PowerShell — parse IIS logs for POST requests
Get-Content u_ex251215.log | Where-Object { $_ -match "POST" -and $_ -match " 200 " }

6. Building an Attack Timeline

Correlate across all log sources into a single chronological view:

Time Source Entry Interpretation
10:00 access.log 404s from 192.168.1.5 Reconnaissance / scanning
10:15 access.log POST /upload.php 200 File upload succeeded
10:15 access.log GET /images/shell.php?cmd=whoami 200 Webshell confirmed
10:16 Security.evtx 4688 w3wp.exe → cmd.exe OS-level execution
10:17 access.log GET shell.php?cmd=net+user 200 Privilege enumeration
10:20 access.log GET shell.php?cmd=powershell… 200 Reverse shell attempt

Tips

  • IIS logs are in UTC by default — confirm before correlating with Windows event logs which are also UTC
  • User-Agent strings are trivially spoofable — use them for pattern recognition, not attribution
  • A 200 response to a webshell request does not confirm the command succeeded — check the response byte count; a very small response may indicate an error
  • Attackers often delete webshells after use — absence of the file does not mean no access occurred; the log entry is evidence
  • Check the Referer header in logs — a direct request to a webshell without a referer is suspicious; automated tools often leave no referer
  • If the attacker used a VPN or Tor, source IPs will rotate — look for User-Agent consistency or session token reuse across IPs as alternative correlation points