The best chance for a "quick win" during a major IR is to review the event logs.
Logs may reveal every attack step, so always include them in your collection pack.
Windows Event Logs
Windows event logs are generated by the OS in real time and can reveal a lot of things other artifacts can't reveal reliably: authentication attempts, persistence traces, PowerShell commands, and much more if properly configured. Event tampering is also very uncommon among adversaries, so the logs you'll review can typically be trusted. A few examples of what event logs can answer:
- Who logged on to MAIL-01, when, and from where? → Security log, event ID 4624
- Did anyone access the Contracts share last week? → Security log, event ID 5140
- What is that "svcuser", who created it, and when? → Security log, event ID 4720
- What PowerShell cmdlets were seen on DC-04? → PowerShell log, event ID 4104
- What processes were spawned by malware.exe? → Sysmon log, event ID 1 and 5
Event Logs Collection
The event logs are organized in EVTX files, often called log channels or just logs: Security.evtx, System.evtx, and hundreds more. They are all located in the C:\Windows\System32\winevt\Logs\ folder, which you can just copy and process on your DefenseBox. The average size of the folder is 50-400 MB, but it can reach a few gigabytes on some configurations.
On DefenseBox, you can read the logs with the default Event Viewer, or export them to CSV with EvtxECmd and read them in another viewer or ingest the file into a SIEM. EvtxECmd is part of Eric Zimmerman's Tools, which we will use extensively throughout the path. Here is how to parse the logs with EvtxECmd, assuming they are exported to the "Export" folder:
EvtxECmd Usage
# 1. Export the EVTX logs to the "Export" folder
# 2. Run EvtxECmd and receive a single merged CSV file
C:\Users\Administrator\Export> EvtxECmd.exe -d EventLogs --csv ./ --csvf evtx_merged.csv
Once the CSV is ready, the two popular options to parse it are Timeline Explorer, a convenient viewer, or a SIEM with a quick upload feature, such as Splunk. Timeline Explorer is sufficient for small log files or when you already know what to hunt for, but for bigger files, a SIEM option would be much more convenient.
Option A: Read the parsed event logs in Timeline Explorer
Option B: Ingest the CSV to Splunk (Settings > Add Data > Upload)
Logging Pitfalls
Properly configured logs make most DFIR work trivial, as they reveal every step of an attack and can be correlated against each other. The problem is, logs are never properly configured. In real engagements, you are guaranteed to hit at least one issue that forces you to rely on sources beyond the event logs. Below are some of the challenges you can face:
| Challenge |
Description |
| Data retention |
- Max size of a Security log is 20 MB. Then, the old logs are overwritten
- On busy systems, this means the logs survive for just a few hours
|
| Disabled channels |
- Many useful event channels are disabled by default
- Sysmon also must be installed manually on each host
- You will rarely see Sysmon logs in large-scale incidents
|
| Log tampering |
- Adversaries often erase the logs (admin privileges required)
- Advanced attackers may also disable logging for some time
- In real DFIR engagements, logs are rarely forwarded to SIEM
|
Summary
Always include event logs in your DFIR collection pack, regardless of the host. Most forensic tools acquire the entire EVTX folder by default, but if you're constrained by collection size for any reason, you can pull just the highest-value channels instead. The exact list will vary with the case, but here is a starting point:
Logged by Default
Security.evtx: Your #1 channel, at least because it reveals logon events (Event ID 4624 and 4625)
System.evtx: Tracks services (Event ID 7040 and 7045), shutdowns, USB and driver events, and more
Windows PowerShell.evtx: Can reveal PowerShell launch and its launch command line
Microsoft-Windows-Windows Defender%4Operational.evtx: Defender detections and AV events
Microsoft-Windows-TerminalServices-RDPClient%4Operational.evtx: RDP logins from the machine
Microsoft-Windows-TerminalServices-LocalSessionManager%4Operational.evtx: RDP logins to the machine
Disabled by Default
Microsoft-Windows-PowerShell%4Operational.evtx: Reveals full, decoded PowerShell commands
Microsoft-Windows-Sysmon%4Operational.evtx: If installed, Sysmon can solve the incident on its own
Practice
For this lab, if you're using DefenseBox, you can collect the logs and other artifacts via SMB. On the target VM, run net use M: \\DEFENSEBOX-IP\C$ /user:DFIRUser, enter the password, and you will see a new mapped drive. Then, you can easily transfer the files from the target (#3 on the image) to any folder on DefenseBox (#2 on the image). In real engagements, though, it's better to use intermediate storage such as a shared FTP server.
Your target for today is JMP-DMZ, OpenDoor's jump host that divides public-facing subnets from the internal AD network. The previous investigation led you to believe the attackers moved laterally to it, so let's quickly copy the lab VM event logs to DefenseBox and start the triage.