Windows event logs
Table of Contents
Windows Event Logs
Windows Event Logs are records of significant activities or errors that occur on a Windows Operating System. For a Security Operations Center (SOC) analyst, these logs are a primary source of information for detecting, investigating, and responding to security incidents. Proper analysis allows an analyst to trace user actions, identify malicious processes, and uncover persistence mechanisms.
Accessing Event Logs
Event logs can be accessed through several methods:
- Event Viewer (
eventvwr.msc): A GUI tool that allows users to browse and filter logs. - PowerShell: The
Get-WinEventcmdlet is a powerful tool for scripting and querying logs on local or remote machines. The olderGet-EventLogis still available but is considered deprecated. - wevtutil.exe: A command-line utility for managing event logs and publishers.
- Log Location: Logs are stored as
.evtxfiles, typically in theC:\Windows\System32\winevt\Logsdirectory.
Key Event Log Categories
Windows organizes logs into several categories. The most important for security analysis are:
- Security: Contains events related to security, such as logon attempts and object access, based on the system's audit policy. This is the most valuable log for a SOC analyst.
- System: Records events logged by the Operating System and its components, like driver failures or system startup/shutdown.
- Application: Contains events logged by software applications. Developers decide what events their applications log.
- PowerShell: Logs command-line activity, including script block logging which can reveal the content of executed scripts. Event ID 4104 is particularly useful for this.
- Sysmon: A supplementary service from the Sysinternals Suite that provides much more detailed logging about process creation, network connections, and file changes. Logs are found in
Applications & Services -> Microsoft -> Windows -> Sysmon -> Operational.
Important Event Is for SOC Analysts
Monitoring specific Event IDs is crucial for identifying suspicious activity. A single critical event or an abnormal pattern of events can signal a threat.
Logon / Logoff Events
- 4624: Successful account logon. Important to monitor for unusual times, locations, and logon types (e.g., Type 10 for RDP, Type 3 for network).
- 4625: Failed account logon. A spike in these events can indicate a brute-force attack.
- 4634 / 4647: An account was logged off. Useful for tracking session duration.
- 4648: A logon was attempted using explicit credentials (e.g., "Run as").
- 4776: The domain controller attempted to validate the credentials for an account. Often seen with NTLM authentication.
Account Management
- 4720: A user account was created. Unexpected account creation is a major red flag.
- 4722: A user account was enabled.
- 4725: A user account was disabled.
- 4726: A user account was deleted.
- 4732 / 4728 / 4756: A member was added to a security-enabled local, global, or universal group. Critical for detecting privilege escalation.
- 4740: A user account was locked out.
Process & Service Monitoring
- 4688: A new process has been created. Enabling command-line auditing for this event provides deep visibility into what is running on a system.
- 7045 / 4697: A new service was installed. A common Persistence technique for attackers.
Object Access & Policy Changes
- 4663: An attempt was made to access an object (e.g., a file or folder). Useful for tracking access to sensitive data.
- 5140: A network share object was accessed.
- 4719: System audit policy was changed.
Evasion & Defense Tampering
- 1102: The audit log was cleared. This is a classic sign of an attacker trying to cover their tracks.
- 1116 / 1117: Windows Defender detects malware or takes protective action.
Centralized Logging and SIEM
In any enterprise environment, managing logs on individual machines is impractical. Windows Event Forwarding (WEF) is a native capability used to send specified event logs from client machines (sources) to a central Windows Event Collector (WEC) server. From the WEC, logs can be ingested by a Security Information and Event Management (SIEM) platform like Splunk, ELK, or Microsoft Sentinel for correlation, alerting, and long-term storage. This centralized approach is fundamental to the operations of a modern SOC.