In short
- Default Windows settings don’t record many of the events needed for attack detection; advanced audit policies must be turned on.
- Priority events: failed sign-ins, privileged sign-ins, new services and tasks, group changes and the log being cleared.
- Logs must be collected centrally; otherwise the attacker can erase their tracks.
The time from an attack’s initial entry to encryption is often days, even weeks. During that time the attacker leaves traces in the Windows event logs: failed sign-in attempts, newly created accounts, installed services, cleared logs… The problem is that these traces are either never recorded or never read by anyone. This article summarises for IT teams which events should be monitored and how to do it.
First, make sure events are being recorded
The default audit settings are inadequate. In Group Policy, under Computer Configuration › Windows Settings › Security Settings › Advanced Audit Policy Configuration, turn on at least the following:
- Account Logon: Credential Validation, Kerberos Authentication Service, Kerberos Service Ticket Operations
- Account Management: User Account Management, Security Group Management
- Logon/Logoff: Logon, Account Lockout, Special Logon
- Detailed Tracking: Process Creation (plus the “Include command line in process creation events” policy)
- Object Access: Other Object Access Events (for scheduled tasks)
- PowerShell: Script Block Logging
You can see the current state on a server with this command:
auditpol /get /category:*
Event IDs to monitor
| Event | Log | What does it mean? | When to be suspicious |
|---|---|---|---|
4625 | Security | Failed sign-in | Many in a short time, especially logon type 3 (network) and 10 (remote desktop) |
4624 | Security | Successful sign-in | Straight after many failed attempts; an unusual time or source |
4740 | Security | Account locked out | On several accounts at once: password spraying |
4672 | Security | Sign-in with special privileges | An admin account signing in on an unexpected machine |
4648 | Security | Sign-in with explicit credentials | Connecting from a user computer to servers with a different identity |
4688 | Security | New process created | Suspicious command lines: encoded PowerShell, vssadmin delete shadows, wmic |
4720 | Security | User account created | Out of hours or by an unknown admin |
4728 / 4732 / 4756 | Security | Member added to a security group | Additions to privileged groups such as Domain Admins or Administrators |
4697 / 7045 | Security / System | New service installed | Randomly named services or ones running from a temp folder; remote management tools |
4698 | Security | Scheduled task created | Tasks created for persistence |
4769 | Security (DC) | Kerberos service ticket requested | Many from one user in a short time with encryption type 0x17 (RC4): Kerberoasting |
4771 | Security (DC) | Kerberos pre-authentication failed | Across many accounts: password guessing |
4104 | PowerShell/Operational | PowerShell script block | Encoded commands, downloading scripts from the internet, disabling security tools |
1102 | Security | Security log cleared | Almost always: an attacker may be erasing their tracks |
Quick PowerShell queries
Even without a central log solution, you can run a quick check on critical servers with these queries:
# Failed sign-ins in the last 24 hours: the most targeted accounts
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4625; StartTime=(Get-Date).AddDays(-1)} |
ForEach-Object { $_.Properties[5].Value } |
Group-Object | Sort-Object Count -Descending | Select-Object -First 10 Count, Name
# Additions to privileged groups in the last 7 days
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=4728,4732,4756; StartTime=(Get-Date).AddDays(-7)} |
Select-Object TimeCreated, Id, Message
# New services installed in the last 7 days
Get-WinEvent -FilterHashtable @{LogName='System'; Id=7045; StartTime=(Get-Date).AddDays(-7)} |
Select-Object TimeCreated, Message
# Has the security log been cleared?
Get-WinEvent -FilterHashtable @{LogName='Security'; Id=1102} -ErrorAction SilentlyContinue
Note: the index of event properties (for example Properties[5]) varies by event type. Check the queries against a sample event in your own environment.
Warning signs specific to ransomware
- Shadow copies being deleted (
vssadmin delete shadows,wmic shadowcopy delete) - The recovery environment being disabled (boot settings changed with
bcdedit) - Security software services being stopped or new exclusions being added
- Backup services being stopped and backup catalogues being deleted
- The same new service or scheduled task appearing on many servers in a short time
When any of these signs appears, time is critical: affected systems must be disconnected from the network and incident response steps started.
Collect and retain logs centrally
- Increase log size: on domain controllers and critical servers, the security log fills up within a few days at its default size.
- Central collection: with Windows Event Forwarding (WEF), you can forward events to a single collector server without extra licences; larger environments prefer a SIEM solution.
- Alert rules: set up instant notifications for 1102, privileged group changes and new service installations.
- Retention period: keeping records for at least a few months is recommended for incident investigation. For businesses that process personal data, access logs are also part of KVKK technical measures.
- Sysmon: add Sysmon with a well-tuned configuration for detail the built-in logs can’t see (network connections, process tree, file creation). See our Sysmon guide.
Conclusion
Event logs are the attacker’s footprints on your network, but they are only useful if they are recorded, collected and read. With the right audit policies, central collection and instant alerts for a few critical events, your chances of spotting an attack before encryption begins rise sharply. For measures on the Active Directory side, see our article on Active Directory hardening. At SistemON, as part of our cyber security service, we configure audit policies, collect logs centrally and set up alert rules for critical events.
Frequently Asked Questions
Should we review event logs on each server one by one?
No. Logs should be collected in a central location with Windows Event Forwarding (WEF) or a SIEM/log management solution. That makes review easier, and when an attacker clears the logs on one server, the copy stays safe.
How large should the security log be?
On most servers the default size fills up within a few days and old records are overwritten. On domain controllers and critical servers, increase the log size to hold at least a few weeks of records, and store them centrally.
What is Sysmon, and should we install it?
Sysmon is one of Microsoft’s Sysinternals tools; it records events such as process creation, network connections and file changes in far more detail than the built-in logs. Used with a well-tuned configuration file, it makes a serious difference to attack detection.
Need help with this?
Let us review your infrastructure free for the first month and share a clear list of risks and priorities.