Windows Security Event Logs – What to Monitor?
The following is a table of event codes that I’ve found to be extremely valuable to log and monitor in an environment. Some trend more towards general environment health and activity monitoring, however they all have a foothold in security value as well. As always, your environment’s needs and requirements will be different depending on a multitude of other factors such as compliance and log retention, and these should be taken into consideration when choosing what to log – and for how long. The logging volume of these event codes will also depend on the size of your environment, so this should also be considered.
Audit log cleared
A common strategy for attackers once in an environment is to cover their tracks. While some attackers are sophisticated and will use equally sophisticated – and manual – methods to accomplish this, many attackers will just blast the Windows audit log away.
Security log is now full
For this event and 1108, we want to make sure we’re collecting security logs at all times. A cessation in logging can cause a major headache for investigations, compliance, etc – most importantly, you can’t know what you don’t see.
Event logging service error
See above, though this one is less common.
Account successfully logged on
Monitor this event code in tandem with 4625 – all the failed authentications in the world will mean nothing if you don’t know if it was ever successful or not.
Account failed to log on
A bread and butter security event to monitor, this lets you detect all sorts of potentially malicious behavior as brute force attacks are some of the most common out there.
A logon was attempted using explicit credentials
This is good to track for monitoring where credentials are being used explicitly. It doesn’t necessarily indicate a security risk, however it’s good to keep an eye on where these are coming from.
Special privileges assigned to new logon
This event is a bit confusing in its name – it’s not denoting that a logon has been given special privileges, more that an account that has special privileges has logged on – so you’ll see this in tandem with 4624 events. This should be monitored to detect rogue superuser accounts or over-privileged accounts.
Scheduled task created
Attackers and malicious programs will frequently create scheduled tasks to provide them persistence within an environment. By monitoring this event along with 4700 you can watch for suspicious or unknown scheduled tasks being created.
Scheduled task enabled
User account created
This is more of an environment tracking event code, however attackers will sometimes create accounts for them to utilize and pivot from if they’ve gained an amount of access. These should be tracked both to detect that activity and to just generally see what’s going on in your environment.
An attempt was made to change the password of an account
Due to how Windows logs, this event probably doesn’t mean what you think it does. It detects a user attempting to change their own password, not that of another account – most times you’ll see this will be when a user is failing to change their password due to the new password not meeting the password policy. As such you may want to monitor this only for accounts that should never be having their password changed.
User account disabled
More of an environment review event code as the disabling of an account is usually not what attackers are aiming to do. However it can help to detect anomalous activity that should be investigated.
Group created (global)
This along with other group creations should be monitored mostly for environment review, however attackers will sometimes create groups to pivot from or to give multiple accounts footholds should one of them be taken down.
User added to global group
Group created (local)
User added to local group
Account locked out
This is a valuable event code to monitor for privileged accounts as it gives us a good indicator that someone may be trying to gain access to it. This code can also indicate when there’s a misconfigured password that may be locking an account out, which we want to avoid as well. Also, your guess is as good as mine as to why this is located in the middle of the group change events.
Group created (universal)
User added to universal group
User account unlocked
Kerberos authentication ticket was requested
Kerberos authentication event codes should be monitored in the same way 4625 and 4624 authentication events are. These Kerberos event codes will tend to give you a clearer picture on the entire logon attempt process, including at what point in the process the logon failed – pre-authentication or post.
Kerberos preauthentication failed
This event code should be logged and treated similarly to 4625 events, as they represent the other “half” of authentication failures. Windows has different rules for when a 4625 vs a 4771 is logged, and it represents a much more in depth authentication discussion. For our purposes here, know that 4771s will be loud (think cached passwords) but that they can be refined down by keying off their result code field.
The domain controller attempted to validate the credentials for an account
Bit of a misnomer on this one – this event will fire from workstations and servers in the same way it’d fire from a domain controller. This is also the event code you’ll see if something is authenticated via NTLM rather than Kerberos, so it’s also important to include in your authentication logging
The ACL was set on accounts which are members of administrators groups
Equal parts environment review and security risk, we want to investigate these to see why the ACL was changed for these accounts and to ensure it was both intentional and permitted.
The password hash of an account was accessed
Monitor these as hash accesses should be planned, and unplanned hash accesses may represent a security risk or malicious activity
A user’s local group membership was enumerated
For this and 4799, a group’s membership being checked can be a sign of suspicious behavior, as many attackers – once gaining access to an account – will aim to check how valuable their accessed account is. We want to monitor this behavior and note the process name that’s calling this action, as some are expected to be doing this while others are not (mmc.exe vs cain.exe)
A security-enabled local group membership was enumerated
Valuable, but Expensive
These are Windows event codes that can be prohibitively expensive to log, as they can generate hundreds of events in a short period of time. However they provide a great level of insight into an environment, so if disk space – or log ingestion into a SIEM – allows for these to be collected, I encourage them to be logged.
A registry value was changed
A loud event code, this is still very valuable to detect suspicious registry value changes, as another common foothold for persistence is for attackers to alter or add a registry key. There are some key areas in the Windows registry that these footholds would be placed to be most effective – startup registry keys “run” and “run once” – so you can narrow your scope to just these registry paths if needed. See section below, “4657 Registry Keys to Monitor”
New process was created
This will allow you to see any and all new processes that are run in the environment. If that sounds incredibly noisy, it is – however it provides an amazing insight into an endpoint. Additionally you can enable it to include process command line arguments, which allows for endpoint visibility not usually seen without a paid-for tool. If your disk space – or license if ingesting into a SIEM platform – allows for this event code with command line to be ingested, I do suggest it, however it is extremely loud.
An attempt was made to install a service
This event code would be very loud to monitor across all areas, so we want to ensure it’s monitored on critical or otherwise sensitive systems. Service installations should be planned and there are services that attackers would want to install on a high value system. The service type field should be monitored to determine the access level of this new service, while the service start type field should be monitored for how the service is set to run.
4657 Registry Keys to Monitor
Below are some very solid registry keys to monitor, all of which cover the persistence methods discussed above. Rather than log all registry changes, instead focus on these locations to best detect suspicious registry behavior. Credit goes to Mitre ATT&CK for these, I’ve pulled out the paths below – https://attack.mitre.org/techniques/T1547/001/
Run at startup keys:
Startup folder items:
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
- HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
Automatic service startups:
Policy-driven startup programs:
User Logon Program Launch – within “load” value:
- HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows
Autocheck launch – within BootExecute value
- HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager
- This last one is interesting as it’s the path of the automatic disk checking service Microsoft employs upon abnormal shutdowns. Since it’s an automatic function, attackers realized they can adjust this value to also add that same automatic run functionality to their program/process for persistence. It’s pretty cool!
And there you have it! While not a comprehensive end-all-be-all list, these are the Windows event codes I recommend to a customer looking for a “base-line coverage” of security logging. We didn’t cover Application or System logs as they’re out of scope for this specific article, but I may review those in a future posting. For now, happy logging!
Originally posted by Merys R, Security Engineer at CRITICALSTART, on LinkedIn.
Security Engineer at Critical Start
You may also be interested in…
- Consumer Education(39)
- Consumer Stories(2)
- Cybersecurity Consulting(10)
- Data Breaches(15)
- Data Privacy(43)
- Incident Response(9)
- MDR Services(64)
- Penetration Testing(16)
- Press Release(64)
- Research Report(9)
- Security Assessments(16)
- Thought Leadership(17)
- Threat Hunting(9)
- Vulnerability Disclosure(3)