Reading width
Wide uses the full column for everything, text, diagrams, code, and exercises. Narrow keeps the standard reading width.
Text size
Scales the body text. Headings and code blocks keep their size.
In this section
0.5 Windows Events and Processes
Introduction
On Windows, most of what an investigator learns about a machine comes from its event logs. Every Windows machine keeps them, Event Viewer opens them, PowerShell reads them, and security products collect them. Process starts are the backbone of an endpoint investigation, and Windows records them in its own Security log as event 4688. Many organizations add Sysmon, which records them again as event 1, with different details.
This lesson reads one process start in both. It opens the 4688 in Event Viewer, explains the fields that need explaining, compares it with the Sysmon record of the same process, and joins the two on identifiers written in different number bases. Module 5 investigates whole endpoints from records like these, so this is where the reading starts.
You don't need Windows for this lesson: the records are shown on the page. If you have a Windows machine, the Practice section suggests a way to look at your own machine's log alongside these.
Logs, Channels and Event IDs
Where Windows writes things down, and how an export labels themEach stage can change or drop what reaches you: no audit policy, no 4688; the collector renamed the channel
The figure follows one process start from the moment it happens to the line in your export, and opens the stage this lesson reads. Windows writes events into named logs, which it calls channels. The three classic ones are Application, Security and System. Many components add their own, such as Sysmon's Microsoft-Windows-Sysmon/Operational. Each event has a numeric ID that says what kind of event it is, and the same ID can mean different things in different channels.
On a live machine, each channel is stored as an .evtx file. Investigators usually work from copies: .evtx files collected from the machine, or events forwarded to a central store and exported from there. The events in this lesson are the second kind, gathered by a collector in the test lab and exported as JSON lines. Here's what the export holds:
$ jq -r '.Channel' net-local-users.json | sort | uniq -c
16 Microsoft-Windows-Sysmon/Operational
42 Security
37 security
$ jq -r 'select(.Channel | ascii_downcase == "security")
| .EventID' net-local-users.json | sort -n | uniq -c
4 4624
4 4627
1 4672
5 4688
65 5156
Two things stand out. First, the Security log appears twice, once as Security and once as security in lower case. Those are the same channel. The collector wrote the name inconsistently, and a filter for Security alone would miss 37 events. Lesson 0.3's warning about case applies here exactly.
Second, the Security events cover several IDs: logons, network connections permitted by the firewall, process starts and others. Event 4688 is the process start, and there are 5 of them. Microsoft's reference for 4688 says it's generated every time a new process starts, as long as process creation auditing is turned on.
Auditing has to be turned on. Process starts reach the Security log only when audit policy asks for them, and many organizations don't ask, or enable it on servers but not on workstations. Before asking a machine's logs a question, find out whether it was recording the events that would answer it. Lesson 1.9 called that checking the data, and it applies to every endpoint you'll investigate.
A practical way to check is to count events by ID per machine and per day, as lesson 0.3 did. A machine that writes thousands of 4624 logons a day and no 4688 at all isn't auditing process creation. A machine whose 4688 count drops to zero on a particular date had its policy changed, or its log stopped being collected, and either deserves a question.
Event 4688 in Event Viewer
The General tab: the rendered message and the event's own fieldsHere's the 4688 for net.exe, the process from lesson 0.4, in Event Viewer's layout:
A new process has been created. Creator Subject: Security ID: S-1-5-21-4228717743-1032521047-1810997296-1104 Account Name: pgustavo Account Domain: THESHIRE Logon ID: 0x10A7DF Target Subject: Security ID: S-1-0-0 Account Name: - Account Domain: - Logon ID: 0x0 Process Information: New Process ID: 0x1528 New Process Name: C:\Windows\System32\net.exe Token Elevation Type: %%1937 Mandatory Label: S-1-16-12288 Creator Process ID: 0x1d20 Creator Process Name: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Process Command Line: "C:\windows\system32\net.exe" user
Event 4688 for net.exe in Event Viewer's layout: the message as recorded, blank lines removed, its explanatory paragraphs cut
Event Viewer shows two things. The message, at the top, is the event rendered into readable text by the component that wrote it, with labels such as Creator Subject and Process Information. The fields below are the event's system properties: which log, which provider, when, which ID, which task category, and which computer.
The message is grouped into three blocks. Creator Subject is the account that asked for the process to be created: pgustavo in the THESHIRE domain, with its security identifier and logon ID. Target Subject is used when the new process runs under a different logon from its creator. Here it's empty, because the process ran as the same user. Process Information describes the new process and its parent.
Event Viewer's Logged time, 2020-09-21 19:26:20, is shown without a time zone. As in lesson 0.2, it's the machine's local time as this collector recorded it. Sysmon recorded the same process start at 2020-09-21 23:26:20.869 UTC, which shows this lab's clock running four hours behind UTC that evening.
The Details tab holds the same information as named fields, which is the form an export carries and the form you'd query. Event Viewer is the easiest place to read one event closely, and the worst place to read a thousand. Section 6 turns to the tools for that. When you cite an event in a case, cite it by machine, log, record number and time, so a colleague can find the same event in the same file.
Two of the system properties are worth a closer look. Task Category, here Process Creation, groups events into broad kinds, and it's what Event Viewer's filter dialog offers when you don't know an ID. Keywords, here Audit Success, distinguishes successes from failures for audit events. Neither is decisive, but both help you find related events when you're browsing a log by hand.
If you open an .evtx file in Event Viewer on your own machine, it's added under Saved Logs, separate from the machine's own logs. That separation matters: an analyst who filters the wrong log will see their own machine's events and draw conclusions about someone else's.
The Fields That Need Explaining
Elevation, integrity, logon IDs and IDs in hexadecimalMost of 4688's fields mean what they say. Five need explaining, and they're the ones that matter most in an investigation:
Windows' own record of the process start, with the five fields that need explaining
The Token Elevation Type is written as a code: %%1937. Microsoft's reference explains the three values. %%1936 is a full token, used when User Account Control is off or for built-in administrator and service accounts. %%1937 is an elevated token, used when a user runs a program as administrator. %%1938 is a limited token, the normal case for a program that wasn't elevated. So net.exe ran elevated. The reference suggests watching for %%1937 on standard workstations, because it means a user ran something with administrative rights.
The Mandatory Label is the process's integrity level, as a security identifier. Microsoft's table gives S-1-16-12288 as High integrity, consistent with an elevated process. Medium, S-1-16-8192, is a normal user's program, and System, S-1-16-16384, is the operating system's own.
Elevation and integrity are worth checking on every process start in a case. A program that normally runs at Medium appearing at High means someone ran it as administrator. A user process appearing at System usually means something went through a service or a scheduled task, which is a question in itself.
The logon ID, 0x10a7df, identifies the logon session the creating account was in. Every process started in that session carries it, which makes it a way to group everything one sign-in did on this machine.
Looking up the logon event that began the session, a 4624 with the same logon ID, tells you how the user signed in to start it: at the keyboard, over the network or by remote desktop. That event isn't in this export, which is the normal situation: the logon may have happened days before the process start you're investigating.
The process IDs are hexadecimal: the new process is 0x1528 and its creator is 0x1d20. Windows reuses process IDs once a process exits, so an ID identifies a process only together with the machine and the time. And the command line is present here only because someone turned it on. Microsoft's reference says the field is empty unless the policy called Include command line in process creation events is enabled.
Two Logs, One Process
What Windows' own record and Sysmon's record each addSysmon recorded the same process start as its event 1. The two records overlap heavily and differ in useful ways:
Two records of the same process start, and what each one adds
Event 4688 comes with Windows. It needs audit policy to switch it on and a second policy for command lines, but it needs nothing installed. It names the user four ways and records how the process was elevated, which Sysmon expresses only as an integrity level.
Sysmon's event 1 needs Sysmon installed and configured, which plenty of organizations never do. When it's present, it adds a great deal. It records file hashes of the program, so you can check whether net.exe is the genuine Windows file. It records the parent's full command line, which is where lesson 0.4 found the encoded PowerShell. It assigns every process a ProcessGuid that doesn't get reused. And it writes its time as UtcTime, in UTC.
Neither log is complete on its own. A machine with only 4688 can tell you what ran and as whom, but not whether the program file was genuine or how its parent was launched. A machine with only Sysmon is missing Windows' view of elevation. Most organizations have one, some have both and some have neither, and the first job on any endpoint is finding out which. Recording which sources a machine had is part of the case, because it sets what the case can claim.
Endpoint detection products such as Microsoft Defender for Endpoint keep their own process records, which overlap with both. Module 5 uses those too. The habit is the same for all of them: know which source recorded the event, what that source adds, and what it leaves out.
There's a practical consequence for evidence requests. If you need to know whether a program file was genuine, ask for Sysmon or the endpoint product's records, because 4688 has no hash. If you need to know whether it was elevated, 4688 says so directly. Knowing which record answers which question makes requests to other teams precise, and precise requests come back faster.
When both are present, they also check each other. Two independently configured sources that agree on a process start are much stronger evidence than either alone, as lesson 0.3 found when counting process starts.
Joining the Two Records
The same IDs, one log in hexadecimal and the other in decimalTo use both records together, you have to match them. The obvious key is the process ID, but the two logs write it differently: 4688 in hexadecimal, Sysmon in decimal. Converting is simple once you know to do it:
$ printf "%d %d\n" 0x1d20 0x1528
7456 5416
$ jq 'select(.EventID == 1 and .Hostname == "WORKSTATION5.theshire.local")
| {Image, ParentProcessId, LogonId}' net-local-users.json
{
"Image": "C:\\Windows\\System32\\net.exe",
"ParentProcessId": "7456",
"LogonId": "0x10a7df"
}
{
"Image": "C:\\Windows\\System32\\net1.exe",
"ParentProcessId": "5416",
"LogonId": "0x10a7df"
}
The creator process ID in the 4688, 0x1d20, is 7456 in decimal, which is Sysmon's ParentProcessId for net.exe: the PowerShell process. And the new process ID, 0x1528, is 5416, which is the ParentProcessId Sysmon recorded for net1.exe. So the 4688 for net.exe and Sysmon's record of net.exe's child agree on net.exe's process ID, once the bases match.
The logon ID matches too, with a twist: 4688's message shows it in upper case and the field in lower case, while Sysmon wrote 0x10a7df. Hexadecimal digits are the same value in either case, but a text comparison won't treat them as equal. Normalize before joining: convert to one base and one case.
Writing the conversion into your notes helps the reader too. "4688 creator process 0x1d20 (7456), which Sysmon records as net.exe's parent" lets anyone check the join without redoing the arithmetic, and it shows you noticed the difference in bases.
This export is also missing something: Sysmon's own ProcessId for net.exe is empty in the JSON, though Sysmon's process events normally carry one. Somewhere between the machine and this file, the value was lost. That's why the join here goes through the child's ParentProcessId instead. Exports and pipelines lose fields more often than you'd expect, and when a field you need is missing, it's worth checking whether the source had it before concluding it doesn't exist.
Process IDs are reused, so a join on process ID needs the machine and a narrow time window as well. Sysmon's ProcessGuid avoids that problem, which is one of the reasons Module 5 prefers it where it exists.
Join problems like these are invisible until you look. A query that joins 4688 to Sysmon on process ID without converting the base returns nothing, and an analyst reading the empty result might conclude the two logs disagree. Converting first, and testing the join on a pair you know should match, avoids that.
Reading Many Events
Get-WinEvent on Windows, and the same filter on an exportEvent Viewer is for reading one event. For many, analysts use PowerShell's Get-WinEvent, which reads live logs or saved .evtx files and filters them before returning anything. Microsoft's documentation describes its FilterHashtable, which takes keys such as LogName, ID, StartTime, EndTime and Path, where Path accepts .evtx files. It also notes that the cmdlet is available only on Windows.
A filter for this lesson's process starts, written for a collected .evtx file, would look like this:
# On Windows, against the exported .evtx file
Get-WinEvent -FilterHashtable @{
Path = 'C:\cases\workstation5-security.evtx'
Id = 4688
} | Where-Object { $_.Message -match 'net1?\.exe' } |
Select-Object TimeCreated, Id, Message
It isn't run here, because this page is built on a Linux machine and Get-WinEvent needs Windows. Module 5 runs it on Windows against .evtx files you can download. The filter has the same shape as every filter in lesson 0.3: keep events with this ID from this file, then keep the ones that match, then pick fields.
On an export like this lesson's, the same question is answered with jq:
$ jq 'select(.EventID == 4688)
| {EventTime, Hostname, SubjectUserName, NewProcessName}' net-local-users.json
{
"EventTime": "2020-09-21 19:26:20",
"Hostname": "WORKSTATION5.theshire.local",
"SubjectUserName": "pgustavo",
"NewProcessName": "C:\\Windows\\System32\\net.exe"
}
{
"EventTime": "2020-09-21 19:26:20",
"Hostname": "WORKSTATION5.theshire.local",
"SubjectUserName": "pgustavo",
"NewProcessName": "C:\\Windows\\System32\\net1.exe"
}
{
"EventTime": "2020-09-21 19:27:00",
"Hostname": "WORKSTATION6.theshire.local",
"SubjectUserName": "WORKSTATION6$",
"NewProcessName": "C:\\Windows\\System32\\wbem\\WmiPrvSE.exe"
}
{
"EventTime": "2020-09-21 19:27:05",
"Hostname": "WORKSTATION6.theshire.local",
"SubjectUserName": "WORKSTATION6$",
"NewProcessName": "C:\\Windows\\System32\\sppsvc.exe"
}
{
"EventTime": "2020-09-21 19:27:06",
"Hostname": "WORKSTATION6.theshire.local",
"SubjectUserName": "WORKSTATION6$",
"NewProcessName": "C:\\Windows\\System32\\wbem\\WmiPrvSE.exe"
}
All five process starts in the file, with time, machine, user and program. Notice the user field: the three WORKSTATION6 processes were started by the computer account, WORKSTATION6$, which is how Windows names processes started by the machine itself on behalf of a service. On WORKSTATION5, both were started by pgustavo.
Whichever tool you use, filter by ID and time as early as possible. Security logs on busy machines hold millions of events, and reading them all before filtering is slow in Event Viewer, slower in PowerShell, and slowest of all when it fails halfway.
The output also shows a limit of 4688 worth knowing. Its user is the creator's account, which for a service-started process is the machine account. To learn which service started it, you follow the parent process, as lesson 0.4 did, rather than reading the user field.
Event Viewer has a filter too, under Filter Current Log, which takes event IDs, a time range and a few other properties. It's useful for a quick look at one machine. For anything you'll repeat, or across many machines, a command or a query is better, because it can be saved, rerun and attached to the case.
When an Assistant Explains a Missing Field
Tampering, or the default configuration?Assistants are often asked why a log looks the way it does, and they reach for dramatic explanations more readily than dull ones. Here's one asked about an empty command line field.
On another workstation, the 4688 events have an empty Process Command Line field. Does that mean an attacker tampered with the logs?
That is a strong sign of log tampering. Attackers often clear or modify command-line logging to hide what they ran. You should treat the workstation as compromised and preserve the remaining logs.
Check before you use it
The likeliest explanation is the default configuration. Microsoft's reference for 4688 says the command line is recorded only when the Include command line in process creation events policy is enabled. An empty field on a machine where nobody enabled it is normal. Check the policy before suspecting tampering.
An illustrative exchange, written for this lesson: an assistant you ask will word it differently.
The dull explanation is the likely one. Microsoft's reference is plain that the command line field is empty unless a specific policy is enabled. Most machines that record 4688 without command lines simply never had that policy turned on. Treating them as compromised on that basis would send a team chasing an attacker who isn't there.
Asking the assistant the better question helps too. "Which policy controls whether 4688 records the command line, and how would I check whether it's enabled on a machine?" gets a useful, checkable answer, where "is this tampering?" invites a guess.
Tampering does happen. Attackers clear logs, stop services and change audit policy. But those actions leave their own records, and the right question is whether those records exist: a log-cleared event, a policy change, a gap in an otherwise steady stream of events. An empty field that has been empty on every 4688 the machine ever wrote is a configuration, not an event.
The habit to take into Module 5 is to explain a log's shape from its configuration before explaining it from an attacker. Ask what's enabled, on which machines and since when. An assistant can help with that, too: asked what policy controls a field, it will often name the right one. Check the name against Microsoft's reference, as with everything else.
The same principle applies to every missing record, not just this field. A machine with no Sysmon events probably doesn't have Sysmon. A log that starts last Tuesday probably started being collected last Tuesday. A server with no logon events from the weekend may simply have had none. Each of those could be an attacker's doing, and each is far more often a configuration or a quiet period. The records that would show tampering are specific, and the way to tell the two apart is to look for those records rather than to infer from absence.
When you write it up, say which explanation the records support and how sure you are, in lesson 1.6's words. "Command lines were not recorded on this machine; the policy that records them appears not to be enabled" is a finding someone can check.
Practice
Practice
Read one process start in both logs the two process recordsWork from the export used in this lesson. Every field you need is shown on the page, in sections 2 to 5.
If you have a Windows machine, you can also open your own Security log in Event Viewer and find a 4688 there. You may find none, if process creation auditing isn't enabled on your machine, which is a useful finding in itself.
- Take the pair. Use net1.exe's 4688 and Sysmon event 1, both in the export used in this lesson.
- Read the 4688. Write its user, logon ID, new process ID, parent, elevation type and integrity label, with what each means.
- Join it. Convert its hexadecimal IDs and find the Sysmon event they match, as section 5 does.
- Say what each adds. List one thing each log records that the other does not.
Lesson 0.6 moves from the endpoint to the cloud, and to records kept by services rather than machines: sign-in, mail and audit records for one user's morning, each naming the same person differently.