SECURITY ENGINEERING · PART 1 · LINUX AND WINDOWS, FROM THE INSIDE · WINDOWS · 18 OF 229

Windows Event Logs for Security: Key Event IDs

Where Windows records security activity and how to turn it into detection: the Security, System and PowerShell logs, the event IDs that matter (logons 4624/4625, privilege use, process creation 4688, service and scheduled-task changes), why the defaults log too little, enabling command-line and PowerShell logging and Sysmon, and forwarding everything to a SIEM.

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 9
  9. 10
  10. 11
  11. 12
  12. 13
  13. 14
  14. 15
  15. 16
  16. 17
  17. 18
  18. 19
  19. 20
  20. 21
  21. 22
  22. 23
  23. 24
  24. 25
  25. 26
  26. 27
  27. 28
  28. 29
  29. 30
  30. 31
  31. 32
  32. 33
  33. 34
  34. 35
  35. 36
  36. 37
  37. 38
  38. 39
  39. 40
  40. 41
  41. 42
  42. 43
  43. 44
  44. 45
  45. 46
  46. 47
  47. 48
  48. 49
  49. 50
  50. 51
  51. 52
  52. 53
  53. 54
  54. 55
  55. 56
  56. 57
  57. 58
  58. 59
  59. 60
  60. 61
  61. 62
  62. 63
  63. 64
  64. 106
  65. 107
  66. 108
  67. 109
  68. 110
  69. 111
  70. 112
  71. 113
  72. 114
  73. 115
  74. 116
  75. 117
  76. 118
  77. 119
  78. 120
  79. 121
  80. 122
  81. 123
  82. 124
  83. 125
  84. 126
  85. 127
  86. 128
  87. 129
  88. 130
  89. 131
  90. 132
  91. 133
  92. 134
  93. 135
  94. 136
  95. 137
  96. 138
  97. 139
  98. 140
  99. 141
  100. 142
  101. 143
  102. 144
1 / 11

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Security/System/PowerShell logs
  • key IDs: 4624/4625, 4688, 4697/4698, 1102
  • enable cmd-line + Sysmon
  • forward to a SIEM

Notes

The logs

Windows splits logs into channels. The Security log is the main one: logons, privilege use, process creation and policy changes. The System log covers services, drivers and the event log service itself. The Application log holds application events. And separate operational logs, especially the PowerShell ones, record script activity. You read them in Event Viewer, or from the command line and scripts with wevtutil and Get-WinEvent, which matter when you automate collection.

Where to look
  • Security log: logons, privilege use, process creation, policy changes
  • System log: services, drivers, the event log itself
  • Application log: app events
  • PowerShell / Operational logs: script activity
  • read with Event Viewer or wevtutil / Get-WinEvent

Logon events

The logon events are the ones to know. 4624 is a successful logon, 4625 a failed one. The logon type tells you how: type 2 is someone at the keyboard, type 3 a network logon such as a file share, type 10 remote desktop. 4648 is a logon using explicitly supplied credentials, common in lateral movement. And 4672 means special privileges were assigned, flagging an admin logon. A burst of 4625 then a 4624 is a brute force that worked.

Logon event IDs
  • 4624 successful logon
  • 4625 failed logon
  • 4634 / 4647 logoff
  • logon type matters: 2 interactive, 3 network, 10 remote desktop
  • 4648 logon with explicit creds
  • 4672 special privileges assigned (admin logon)

Process + changes

Beyond logons, watch what runs and what changes. Event 4688 records a new process; you must enable command-line capture so it includes the full command, not just the program name. 4697 is a new service installed, 4698 a scheduled task created, both classic persistence. 4720 is a new account, and being added to a privileged group shows as 4728 or 4732. And event 1102 means the security log was cleared, almost always an attacker covering tracks.

More IDs that matter
  • 4688 a new process started (enable command-line capture!)
  • 4697 a service was installed
  • 4698 scheduled task created
  • 4720 user account created
  • 4728/4732 added to a privileged group
  • 1102 the security log was cleared (big red flag)

Defaults log too little

Out of the box, Windows logs too little to catch modern attacks. Turn on the useful parts: process creation with the command line, so you see what ran. PowerShell script block logging, event 4104, which records the scripts attackers run even when obfuscated. A proper audit policy covering logon, account management, privilege use and object access. And Sysmon, a free Microsoft tool adding rich process, network and image-load events. Without these, living-off-the-land attacks are nearly invisible.

Enable these
  • process creation (4688) WITH command line
  • PowerShell script block logging (4104) and module logging
  • audit policy: logon, account mgmt, privilege, object access
  • Sysmon for rich process, network and image-load events
  • without this, modern attacks are nearly invisible

Sysmon

Sysmon deserves its own moment. It is a free Microsoft Sysinternals tool that logs process creation with the full command line and parent process, network connections tied to the process that made them, image and DLL loads, and file and registry changes. It is driven by a config file, with excellent community baselines to start from. For most organisations, deploying Sysmon with a good config is the single biggest improvement to Windows detection, because it records what attackers actually do.

What Sysmon adds
  • process creation with full command line and parent
  • network connections per process
  • image / DLL loads
  • file and registry changes
  • driven by a config (e.g. the community SwiftOnSecurity one)
  • the backbone of most Windows detection

Forward it

As with Linux, local logs are evidence an attacker can clear, and event 1102 shows exactly that. So forward everything off the machine, with built-in Windows Event Forwarding or an agent such as Winlogbeat or your SIEM vendor's collector, into a central system. Now the record survives an attacker clearing the local log, and you can hunt across every machine at once, correlating a logon on one host with a process launch on another. Part thirteen builds that pipeline and the detections.

Centralise
  • Windows Event Forwarding (WEF) or an agent (Winlogbeat, the Elastic/Wazuh/Splunk agent)
  • send to a SIEM (Part 13)
  • so logs survive event-log clearing (ID 1102)
  • and you can hunt across every machine at once

High-signal detections

A handful of detections catch a great deal. Failed logons followed by a success. The security log being cleared. A document or browser process spawning PowerShell or the command prompt, a classic sign of a malicious attachment, which you see through process creation and Sysmon parent-child data. Encoded or hidden PowerShell in the script block logs. A new service or scheduled task appearing. And an account suddenly added to the administrators group. Each is rare in normal use and maps to a real attacker step.

Alert on these
  • 4625 bursts then a 4624
  • event log cleared (1102)
  • Office or browser spawning powershell/cmd (4688/Sysmon)
  • encoded or hidden PowerShell (4104)
  • new service or task (4697/4698)
  • account added to admins (4728/4732)

Common mistakes

Mistakes. Running with the default audit policy, which misses most of what matters. Logging process creation without the command line, so you see that PowerShell ran but not what it did. No PowerShell script block logging. No Sysmon. Never forwarding logs, so an attacker clears them. Ignoring event one one zero two when the log is cleared, which is one of the loudest signals there is. And the universal failure: collecting mountains of logs and writing no detections on them.

Avoid these
  • default audit policy only
  • 4688 without command line
  • no PowerShell logging
  • no Sysmon
  • logs never forwarded
  • ignoring 1102 (log cleared)
  • collecting logs, writing no detections

Say it like this

In the interview: I use the Security log for logons (4624, 4625, 4672), process creation (4688) with the command line enabled, service and scheduled-task creation, and event 1102 for log clearing. I turn on PowerShell script block logging and deploy Sysmon for rich process and network data, forward everything to a SIEM so it survives log clearing, and alert on high-signal events like document-spawned shells and new admin accounts.

In the interview
  • "The Security log for logons
  • (4624/4625/4672), process
  • creation (4688) with command
  • line, service and task creation, and 1102 for log clearing. I
  • enable PowerShell script block
  • logging and deploy Sysmon, then forward everything to a SIEM and alert on the high-signal IDs."

Interview questions

Q1Which Windows logs matter most for security?

The Security log (logons, privilege use, process creation, policy changes), the System log (services, drivers, the event log service), and the PowerShell operational logs (script activity). Sysmon adds a rich Operational log of process, network and image-load events.

Q2What do event IDs 4624 and 4625 mean?

4624 is a successful logon and 4625 a failed logon. The logon type distinguishes interactive (2), network (3) and remote desktop (10). A burst of 4625 followed by a 4624 indicates a brute-force attempt that succeeded.

Q3Why enable command-line capture for event 4688?

By default process-creation events record only the program name, not its arguments, so you see that PowerShell ran but not what it did. Enabling command-line auditing records the full command, which is essential for detecting malicious activity.

Q4What is event ID 1102 and why does it matter?

It records that the Security event log was cleared. Clearing logs is a common attacker step to cover their tracks, so 1102 is a high-priority alert, especially if the logs were forwarded off-box before the clearing so the evidence survives.

Q5Why is Sysmon recommended for Windows detection?

Sysmon is a free Microsoft tool that logs far more than the defaults: process creation with full command line and parent process, per-process network connections, image/DLL loads, and file/registry changes. With a good config it is the backbone of most Windows detection.

Q6What logging must you enable beyond the Windows defaults?

Process creation with command line, PowerShell script block and module logging (event 4104), a proper audit policy for logon/account/privilege/object events, and Sysmon. Without these, living-off-the-land attacks using built-in tools are nearly invisible.

Q7Why forward Windows logs to a SIEM?

Local logs can be cleared (event 1102) by an attacker, and detection needs correlation across many hosts. Windows Event Forwarding or an agent ships logs to a central SIEM so they survive clearing and can be searched and alerted on across the fleet.

Q8What are high-signal Windows detections?

Failed-then-successful logons, the Security log being cleared, Office or browser processes spawning PowerShell/cmd, encoded or hidden PowerShell, new services or scheduled tasks, and accounts added to privileged groups. Each is rare in normal use and maps to a real attacker technique.