Sysadmin September 2024 Edition FR
Sysadmin September 2024 Edition FR
Secrets of Active
Directory Auditing
Contents SysAdmin Magazine September 2024
SysAdmin
Magazine Contents
81
3 Active Directory Auditing Guidelines
№ September '24
2
Contents SysAdmin Magazine September 2024
Active Directory
like logon attempts and directory changes, and identify
security gaps like inactive user and computer accounts.
Using Audit Policy
Auditing
To specify which system events and user activity to track,
However, Active Directory does not audit all security
you use the Audit Policy settings in Active Directory Group
events by default — you must explicitly enable auditing of
Policy. You specify which types of events you want to audit
Guidelines
important events so that they are recorded in the Security
and select the settings for each one. For instance, you can
event log and available for inclusion in audit reports and
log all events when a user account is disabled or a bad
alerts.
password is entered.
3
Contents SysAdmin Magazine September 2024
▪ Basic policies can be set by going to Computer policy name. According to Microsoft, the recommended authentication. It should not be confused with Audit logon
Configuration > Policies > Windows Settings > Security maximum log size for modern OS versions is 4Gb, and the events, which defines the auditing of every user attempt to
Settings > Local Policies > Audit Policy. recommended maximum total size for all logs is 16Gb. You log on to or log off from a computer, as explained below.
can view the logs with Event Viewer.
▪ Advanced policy settings can be found under Computer Here are the recommended settings for the advanced
Configuration > Policies > Windows Settings > Advanced Audit account logon events policy:
Audit Policy Configuration > Audit Policies.
▪ Audit Credential Validation: Failure
You can define auditing policies for both the entire domain The key to effective auditing is knowing which events to Note that logoff events are not tracked on domain controllers
and individual organizational units (OUs). Note that a log. If you track too many events, your logs will be so full of unless you are actually logging into that specific DC.
setting configured at the OU level has higher priority than a noise that they’ll be hard to analyze and they’ll overwrite
domain-level setting and will override it in case of conflicts. themselves quickly. But if you fail to track critical events,
You can check the resulting policies using the auditpol you’ll be unable to detect malicious activity and investigate
command-line utility. security incidents. Here are the recommended events to Audit logon events
track to strike the right balance.
This policy can record all successful and failed attempts
to log on or off a local computer, whether by a domain
Configuring the Security Log Audit account logon events account or a local account. This information is useful for
intruder detection and post-incident forensics. Microsoft
You’ll also need to specify the maximum size and other provides descriptions of the various event IDs that can be
To detect unauthorized attempts to log in to a domain,
properties of the Security log using the Event Logging logged.
it is necessary to audit logon events — both successful
policy settings. To change settings via GPME, navigate to
and failed. Audit account logon events provides a way to
Computer Configuration > Policies > Windows Settings
track authentication events, such as NTLM and Kerberos
> Security Settings > Event Log and double-click the
4
Contents SysAdmin Magazine September 2024
Audit Directory Service Access: Success, Failure ▪ Audit Policy Change: Success, Failure
Audit Directory Service Changes: Success, Failure ▪ Audit Authentication Policy Change: Success, Failure
▪ Audit MPSSVC Rule-Level Policy Change: Success,
Account management Failure
▪ Audit Other Policy Change Events: Failure
Carefully monitoring all changes to user accounts helps Object access
minimize the risk of business disruption and system
unavailability. Audit this only if you need to see when someone used
privileges to access, copy, distribute, modify or delete
At a minimum, it is recommended to set the basic Audit files on file servers. Enabling this setting can generate
Directory service access
account Management policy to “Success”. If you are using a large volume of Security log entries, so use it only if
Turn this on only if you want to track each instance of user
Advanced audit policies, use the following settings: you have a specific use for that data. The recommended
privileges being used. Enabling this policy can generate a
advanced settings are:
large volume of entries in your Security logs, so do so
▪ Audit Application Group Management: Success, Failure
only if you have a specific use for that data. To enable this
▪ Audit Computer Account Management: Success Audit Detailed File Share: Failure
policy, configure the following:
▪ Audit Distribution Group Management: Success Audit File Share: Success, Failure
▪ Audit Other Account Management Events: Success Audit Other Object Access Events: Success, Failure
Audit Sensitive Privilege Use: Success, Failure
▪ Audit Security Group Management: Success Audit Removable Storage: Success, Failure
▪ Audit User Account Management: Success, Failure
5
Contents SysAdmin Magazine September 2024
6
Contents SysAdmin Magazine September 2024
7
Contents SysAdmin Magazine September 2024
Who Deleted auditing tools? 4. Select the “Security” tab > “Advanced” button > “Audit-
ing” tab > Click “Add”.
a Group Policy 1. Run GPMC.msc > open “Default Domain Policy” > Com-
puter Configuration > Policies > Windows Settings > Secu-
5. Select Principal: “Everyone”; Select “Type: All”; Select “Ap-
Object
plies to: This folder, subfolders and files”; Select the fol-
rity Settings:
lowing “Advanced Permissions”: Write attributes; Write ex-
▪ Advanced Audit Policy Configuration > Audit Policies > tended attributes; Delete; Delete subfolders and files; Click
Object Access > Audit File System > Define > Success “OK” three times.
and Failures
Jeff Melnick ▪ Advanced Audit Policy Configuration > Audit Policies > 6. To define what group policy was deleted filter Security
IT Security Expert, Blogger Object Access > Audit Handle Manipulation > Define > Event Log for Event ID 4663 (Task Category – “File System”
Success and Failures or “Removable Storage”) and search for “Object Name:”
▪ Local Policies > Audit Policy > Audit directory service ac- string, where you can find the path and GUID of delet-
Group Policy Objects (GPOs) can provide configurations
cess > Define > Success and Failures ed policy and “account name” field contains information
for access to shared resources and devices, enable
▪ Event Log > Define > Maximum security log size to 1gb about who deleted it.
critical functionalities or establish secure environments.
and Retention method for security log to Overwrite
If some of the GPOs are deleted, users may not be able
events as needed.
to access the Internet, modify their data, use peripherals
or even log in to their systems. Deleting GPOs that deal
2. Open ADSI Edit > Connect to Default naming context >
with access control, authentication and other security
DC=domain name > CN=System > right click “CN=Policies”
policies may increase systems’ vulnerability and allow
> Properties > Security (Tab) > Advanced > Auditing (Tab) >
unauthorized access.
Click “Add” > Choose the following settings:
8
Contents SysAdmin Magazine September 2024
Active Directory Last Logon AD Attribute across a network’s domain controllers would have been over-
whelming, especially at its time of introduction twenty years
Attributes: Last
The Last-Logon attribute contains a Windows FileTime rep-
ago. But this behavior is also the reason that it is necessary
resentation of the last time a domain controller successfully
to be careful when using this attribute to report on stale user
authenticated the user. It is the granddaddy of user logon
Logon
accounts.
metadata, having been around since the first version Active
Directory.
Because Last-Logon is not replicated (domain controllers
don’t exchange this information), attribute values can be in-
Joe Dibley Using the PowerShell command below, you can retrieve the
terpreted only in the context of the domain controller being
Security Researcher at Netwrix last logon time and other user properties on a domain con-
queried. That is, the attribute’s value is not necessarily the
troller:
last time the user logged in, but rather the last time the user
successfully authenticated through the domain controller
Active Directory user objects possess a number of logon
Get-ADUser -Filter * -Properties being checked. Similarly, the attribute having a value is zero
metadata attributes that are valuable for Active Directory au-
lastLogon | Select samaccountname, @ does not necessarily mean that the user has never logged
dit reporting and administration. For example, they are com-
{Name="lastLogon";Expression={[date- in; it may mean that the domain controller that returned the
monly used to identify user accounts that have been inactive
time]::FromFileTime($_.'lastLogon')}} value has never processed a login request from that user.
for a significant period, or as “stale” accounts.
9
Contents SysAdmin Magazine September 2024
10
Contents SysAdmin Magazine September 2024
all of these logon and logoff events since each event has a unique ID. However, there’s no way to know how long that user account
How to Get User was logged on. Using a little patience and event log snooping we can.
Logon Session To figure out user session time, you’ll first need to enable three advanced audit policies; Audit Logoff, Audit Logon and Audit Other
Logon/Logoff Events. The combination of these three policies get you all of the typical logon/logoff events but also gets the worksta-
Event Log
Adam Bertram
IT consultant and Microsoft MVP
11
Contents SysAdmin Magazine September 2024
When these policies are enabled in a GPO and applied to a In this instance, you can see that the LABAdministrator
set of computers, a few different event IDs will begin to be account had logged in (ID 4624) on 8/27/2015 at 5:28PM
generated. They are: with a Logon ID of 0x146FF6. I then looked up through the
event log at the subsequent messages until I found a ses-
▪ Logon – 4624 (Security event log)
sion end event (ID 4634) that showed up with the same
▪ Logoff – 4647 (Security event log)
Logon ID at 5:30PM on the same day. Knowing this Logon
▪ Startup – 6005 (System event log)
ID, I was then able to deduce that the LABAdministrator
▪ RDP Session Reconnect – 4778 (Security event log)
account had been logged on for three minutes or so.
▪ RDP Session Disconnect – 4779 (Security event log)
▪ Locked – 4800 (Security event log)
This was just a quick demonstration of actual logon/logoff
▪ Unlocked – 4801 (Security event log)
scenarios. You’ll find that when you review a computer in
the “real world” you can’t always depend on logon/logoff
You’ll notice the startup event. Why that one? The reason is
events if you’d like to find user session durations. Multiple
because what if the computer’s power plug is pulled while
scenarios may come into play such as when a user locks
a user is logged in? How will we know when that is. It’s not
her computer and comes back to unlock it. Perhaps she
a perfect metric but it’s the only date/time we have to show
may lock her computer and the power gets cut. There will
when that happened.
be no unlock event; only a startup event. These are the
gotchas you need to watch out for to be able to accurately
Once we’ve got all of the IDs put together, we’ll then need
calculate user session history.
to match the session start event with the very next session
end event. But what if there are multiple users logging into
a computer? To differentiate we can use the Logon ID field.
This is a unique field for each logon session. If we can find
a session start time and then look up through the event
log for the next session stop time with the same Logon ID
we’ve found that user’s total session time.
12
Contents SysAdmin Magazine September 2024
How-to for IT Pro 4. Link the new GPO to OU with Computer Accounts: Go to "Group Policy Management" > right-click the defined OU > choose
Link an Existing GPO > choose the GPO that you created.
1. Run gpmc.msc > Create a new GPO > Edit it: Go to "Com-
puter Configuration" > Policies > Windows Settings >
Security Settings > Advanced Audit Policy Configuration
>Audit Policies > Logon/Logoff:
13
Contents SysAdmin Magazine September 2024
ц Leverage Active Directory auditing with Netwrix Auditor Detect security incidents with continuous
to maintain security and prove compliance Active Directory change auditing and alerting
TOOL OF THE MONTH Answers to many crucial questions are buried deep in
your Active Directory change logs. Who deleted an ac-
count? Who added an account to a Domain Admins
group? Who reset a user’s password? You need detailed
answers to these questions ASAP. Most legacy audit tools
can’t help you get them. Netwrix Auditor can.
14
Contents SysAdmin Magazine September 2024
[On-Demand Webinar]
Fortifying On-Premises
Join us as we delve into the critical challenges of protecting Active Directory (AD) environments
from identity-based threats. As cybercriminals increasingly target identities and systems, it's
Identity Systems:
essential for organizations to adapt by enhancing their detection, response, and mitigation
strategies in real time. Protecting your key on-premises identity infrastructure — Active
Prevention, Detection ensuring your organization is prepared to combat the ever-evolving identity threat landscape.
& Response ▪ Understand the key risks and vulnerabilities specific to AD attacks.
▪ Discover best practices for reducing your identity attack surface and remediating
misconfigurations.
▪ Learn how to implement real-time detection and response strategies to safeguard your on-
Adam Laub premises identity infrastructure.
General Manager ▪ Explore the latest technologies and techniques to prevent credential theft and privilege
abuse within your AD environment.
Kevin Joyce
Senior Technical Product Manager at Netwrix
Regester Now
15
About Netwrix
What did you think
of this issue?
Netwrix champions cybersecurity to ensure a brighter digital future for any organization. Netwrix's
innovative solutions safeguard data, identities, and infrastructure reducing both the risk and impact
of a breach for more than 13,500 organizations across 100+ countries. Netwrix empowers security
professionals to face digital threats with confidence by enabling them to identify and protect sensitive
data as well as to detect, respond to, and recover from attacks.
300 Spectrum Center Drive 1-949-407-5125 Spain: +34 911 982608 Switzerland: +41 43 508 3472 Hong Kong: +852 5808 1306
Suite 200 Irvine, CA 92618 Toll-free (USA): 888-638-9749 Italy: +39 02 947 53539
Netherlands: +31 858 887 804 France: +33 9 75 18 11 19
5 New Street Square +44 (0) 203 588 3023 SOCIAL: netwrix.com/social
London EC4A 3TW