Network & remote access
IIS Web Server Logs
IIS logs cheat sheet: W3C log location per site, UTC timestamps, default fields, HTTPERR, applicationHost.config and how to hunt webshells on Windows servers.
- Location
- C:\inetpub\logs\LogFiles\W3SVC<siteID>\u_exYYMMDD.log
- Proves
- Which client IP requested which URL, with method, status code and user agent, per IIS site
- Timestamps
- date and time columns in UTC by default (W3C format), one file per day
- Retention
- Daily rollover by default; IIS never deletes old logs, so history is limited only by disk and admin cleanup
- Access
- Administrator; the current day's file is open by IIS, and entries are buffered before being flushed
- Evidence of
- Network & remote accessPersistenceExecution
- Type
- File / file system
- Windows
- XPVista / 78 / 8.11011
- KAPE target
- IISLogFiles
- Velociraptor
- Windows.Triage.Targets:IISLogFiles
Tools
Compare all toolsWhat it is
Internet Information Services (IIS) is the Microsoft web server behind many internet-facing Windows hosts: intranet apps, SharePoint, and Exchange (OWA, ECP, EWS, Autodiscover). By default it writes one W3C text log per site per day. On a compromised web server these logs are often the only record of the initial exploit and of the requests that drove a webshell.
Location
| Version | Default log path | Notes |
|---|---|---|
| IIS 5.1 / 6 (XP, Server 2003) | %SystemRoot%\System32\LogFiles\W3SVC<siteID>\exYYMMDD.log | |
| IIS 7 and later (Vista and later) | %SystemDrive%\inetpub\logs\LogFiles\W3SVC<siteID>\u_exYYMMDD.log | u_ means UTF-8 |
| HTTP.sys errors | %SystemRoot%\System32\LogFiles\HTTPERR\httperr*.log | Requests rejected before IIS (bad requests, timeouts, 503) |
| Server configuration | %SystemRoot%\System32\inetsrv\config\applicationHost.config | Sites, bindings, physical paths, log settings |
| Site configuration | web.config in each web root | Handlers, modules, authentication |
<siteID> maps to a site in applicationHost.config (Default Web Site is 1). Admins frequently move logs to another drive: always read the logFile directory attribute there first.
What it proves
- A client IP sent a specific HTTP request (method, path, query string) at a given time, and what the server answered (status, substatus, Win32 status, time taken).
- Repeated requests to one
.aspxfile from few IPs, typicallyPOST, suggest webshell use.
It does not record request or response bodies, POST parameters, or cookies by default. Behind a load balancer or reverse proxy, c-ip is the proxy; the real client appears only if an X-Forwarded-For custom field was configured. A 200 response does not prove the attacker's command succeeded.
Key fields
| Field | Meaning | Default |
|---|---|---|
date, time | Request time (written when the response completes; subtract time-taken for long requests) | Yes |
s-ip, s-port | Server IP and port | Yes |
cs-method | GET, POST, etc. | Yes |
cs-uri-stem, cs-uri-query | Path and query string | Yes |
cs-username | Authenticated user (- if anonymous) | Yes |
c-ip | Client IP | Yes |
cs(User-Agent), cs(Referer) | Client headers | Yes |
sc-status, sc-substatus, sc-win32-status | Response status | Yes |
time-taken | Milliseconds | Yes |
cs-host, sc-bytes, cs-bytes | Host header, bytes out/in | No, must be enabled |
The #Fields: header line in each file lists the actual columns; they can change mid-file after a config change.
Timestamps
| Timestamp | Format | Pitfalls |
|---|---|---|
date + time | YYYY-MM-DD HH:MM:SS, UTC for W3C | Other log formats (IIS, NCSA) use local time; see UTC and local time |
File name YYMMDD | UTC day unless "Use local time for file naming and rollover" is set | One day's activity can span two files in local terms |
| Web root file times | NTFS, UTC | Webshell creation time: check $MFT and the USN journal for timestomping |
Retention and clearing
- Default rollover is daily; IIS has no built-in deletion, so months or years of logs often exist unless a scheduled cleanup script runs.
- Entries are buffered in memory and flushed periodically; on a live server run
netsh http flush logbufferbefore collecting. - Attackers delete or truncate log files or disable logging in
applicationHost.config; missing days and a changedlogFileelement are both findings.
Collection
Get-Content C:\Windows\System32\inetsrv\config\applicationHost.config | Select-String "logFile|physicalPath|<site "
netsh http flush logbuffer
robocopy C:\inetpub\logs\LogFiles E:\case\IIS /E /COPY:DAT /DCOPY:T
robocopy C:\Windows\System32\LogFiles\HTTPERR E:\case\HTTPERR /COPY:DAT
KAPE IISLogFiles collects the default locations only; add custom log directories manually. Also copy the web roots (physicalPath values) to hash and review scripts.
Parsing tools
- Log Parser 2.2 / Log Parser Studio: SQL over W3C logs.
LogParser.exe -i:IISW3C "SELECT c-ip, cs-method, cs-uri-stem, COUNT(*) AS hits FROM u_ex*.log WHERE cs-uri-stem LIKE '%.aspx' GROUP BY c-ip, cs-method, cs-uri-stem ORDER BY hits DESC"
- PowerShell / grep: fast string hunts across many files.
- Velociraptor: collection and parsing of IIS logs at scale.
- Timeline Explorer: after converting logs to CSV.
Investigation tips
- Webshells: look for
.aspx,.ashx,.asmxor.configfiles recently created in web roots, rarely requested pages hit only byPOSTfrom one IP, and odd user agents. Compiled pages leaveApp_Web_*.dllunderTemporary ASP.NET Filesin the .NET Framework folder. - Process lineage:
w3wp.exespawningcmd.exe,powershell.exe,whoami.exeor other LOLBins is a top signal. Correlate the request time with Security 4688 or Sysmon event 1, where theUseris the application pool identity (IIS APPPOOL\<name>). - Exchange: the 2021 ProxyLogon and ProxyShell chains left patterns such as unusual requests to
/ecp/or/autodiscover/autodiscover.jsonwith an email address in the query, followed by webshells in OWA/ECP folders. Exchange also keeps its own logs under the install pathLoggingfolder (HttpProxy, ECP, OWA). Use vendor and CISA guidance for exact indicators. - Pivot on attacker IPs across all sites and HTTPERR, then on the time window across Prefetch and Amcache for tools they dropped.
Related artifacts
- Sysmon Event LogSysmon cheat sheet: Operational log location, key event IDs, ProcessGuid and hash correlation, config in the registry, tampering signs and parsing tools.
- Windows event logs (EVTX)Windows event log cheat sheet: EVTX locations, must-know event IDs for logons, processes, services and log clearing, retention, audit policy and parsing tools.
- Prefetch Files (.pf)Windows Prefetch cheat sheet: .pf location per version, run count, the last eight run times, referenced files, retention limits and how to parse.
- Amcache.hveAmcache.hve cheat sheet: file and program inventory keys, SHA-1 hashes, PE metadata, timestamps and why an entry alone does not prove execution.
- Master File Table ($MFT)$MFT cheat sheet: FILE records, $SI vs $FN timestamps, resident data, deleted records, sequence numbers, timestomping checks and MFTECmd parsing.
- USN Journal ($UsnJrnl:$J)USN journal cheat sheet: $UsnJrnl:$J and $Max, record fields, reason flags, parent references, default size, rollover, fsutil and MFTECmd parsing.
Glossary terms
- UTC vs local time in Windows artifactsWhy some Windows artifacts record UTC and others local time, and how the TimeZoneInformation registry key helps normalize a forensic timeline.
- PersistenceMechanisms that let malware or an attacker survive reboots and logoffs, such as Run keys, services, scheduled tasks or WMI subscriptions.
- LOLBin (living-off-the-land binary)A legitimate, signed Windows binary that attackers abuse to download, execute or hide payloads without dropping their own tools.
- Lateral movementAn attacker moving from one compromised host to others in the network, using RDP, SMB, PsExec, WMI, WinRM or remote tasks and services.
Guides
- Hunting Windows Persistence: Registry, Tasks, WMI and MoreFind attacker persistence on Windows: Run keys, services, scheduled tasks, WMI, Winlogon, IFEO, COM hijacking and BITS, mapped to MITRE ATT&CK, with tools.
- Windows Event Log Forensics: EVTX, Event IDs and HuntingA practitioner guide to Windows event logs: EVTX format, key channels, Security and Sysmon event IDs, audit policy, cleared-log recovery and hunting tools.
- NTFS Forensics: $MFT, USN Journal and $LogFile ExplainedRead NTFS like an examiner: MFT record structure, $SI vs $FN timestamps, timestomping checks, USN reason flags, $LogFile, $I30 slack and deleted files.