SYSVOL Scripts Folder: Authenticated Users Write Trap
Overview
A Modify ACE for Authenticated Users on the SYSVOL scripts folder lets any domain-joined computer or low-privilege account overwrite logon.bat or startup scripts. The fix removes that write access while keeping the read access Authenticated Users still need.
At a glance
- Symptom
- Any authenticated domain principal, including a compromised low-privilege account, overwrites a logon or startup script referenced by GPO.
- Likely cause
- Authenticated Users hold Modify or Write NTFS permissions on the SYSVOL scripts subfolder instead of Read & Execute.
- Impact
- The tampered script replicates to every domain controller via DFSR and executes under the security context of each user who logs on, including administrators.
- Verification signal
- Re-run the detection test and a controlled negative-path test.
- Safe correction
- Replace the Authenticated Users entry on the scripts subfolder with Read & Execute, scope write access to a dedicated delegated group, and audit ACLs after every FRS-to-DFSR migration.
- Rollback or recovery
- Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.
The Trap
Authenticated Users hold Modify or Write permissions on the SYSVOL scripts subfolder (SYSVOL\sysvol\<domain>\scripts, which the NETLOGON share exposes), overriding the intended Read & Execute default and opening its logon scripts to hijacking.
The Default State
Promoting a new domain controller sets NTFS permissions on SYSVOL and NETLOGON to Authenticated Users: Read & Execute, which is correct. The problem comes later, when an administrator adding a helpdesk group or deployment service account picks “Authenticated Users” from the object picker because it autocompletes fastest, then grants Modify instead of scoping to a dedicated security group.
Check again during any FRS-to-DFSR migration. Its Eliminated state (dfsrmig /setglobalstate 3) cannot be reversed and needs every DC at Redirected (2) first.
The Blast Radius
Every authenticated principal in the domain is a member of Authenticated Users, including computer accounts and a low-privilege user on one compromised workstation. Any such account can overwrite logon.bat, a .vbs, or a .ps1 referenced by a user’s scriptPath attribute or a GPO script setting.
SYSVOL replication (DFSR, or FRS on older domains) copies the tampered file to every domain controller. Writing a known-good copy back on one DC fixes the others only once replication converges, so confirm the file on every DC.
If SYSVOL itself is damaged, use Microsoft’s authoritative DFSR SYSVOL sync (msDFSR-Enabled=FALSE and msDFSR-Options=1 on the source DC, msDFSR-Enabled=FALSE on every other DC, then the documented re-enable sequence). At the next interactive logon the script runs under the logging-on user’s own token, so a Domain Admin signing in to a standard workstation runs the attacker’s payload with domain admin rights.
The process chain, userinit.exe or explorer.exe starting cmd.exe or powershell.exe, looks like a normal logon, so EDR heuristics tuned for unusual parent processes rarely fire.
The Lead Mechanic Fix
Work on one DC only, against the local path that net share NETLOGON reports, typically C:\Windows\SYSVOL\sysvol\domain.local\scripts, because ACL changes replicate everywhere. Back up with icacls C:\Windows\SYSVOL\sysvol\domain.local\scripts /save C:\Backup\scripts-acl.txt /t, and check the file is not empty. Restore against the parent: icacls C:\Windows\SYSVOL\sysvol\domain.local /restore C:\Backup\scripts-acl.txt.
Try the save and restore on a test folder first to confirm every saved entry comes back. Then replace the entry in one step: icacls C:\Windows\SYSVOL\sysvol\domain.local\scripts /grant:r "Authenticated Users:(OI)(CI)RX". /grant:r replaces the existing explicit grant, so read access never lapses.
On the same path, find child items with their own entry using /findsid *S-1-5-11 /t and correct those one by one. Give write only to a dedicated group: /grant "DOMAIN\GPO-Script-Deployers:(OI)(CI)M", then verify with icacls on two DCs. To break inheritance below scripts, use /inheritance:d, which keeps inherited ACEs as explicit ones.
Never use /inheritance:r, which strips them and can lock out SYSTEM, Administrators and readers on every DC. During an FRS-to-DFSR migration, dfsrmig /getmigrationstate reports only migration state, not permissions, so compare SYSVOL and SYSVOL_DFSR ACLs with Get-Acl against a stored baseline.
Then schedule a check against that baseline that alerts on any ACE giving Authenticated Users or Everyone write, modify or full control.
Related reading
Apply the safer control
Before you change production
Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.
Fix commands and configuration
net share NETLOGONC:\Windows\SYSVOL\sysvol\domain.local\scriptsicacls C:\Windows\SYSVOL\sysvol\domain.local\scripts /save C:\Backup\scripts-acl.txt /tVerify, roll back or escalate
Verify
Re-run the detection test and a controlled negative-path test. Confirm the unsafe behaviour is blocked while approved traffic still succeeds.
Rollback
Restore the exported configuration if the new control blocks required production traffic, then narrow the policy before redeployment.
Escalate
Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.
Fixed? Get the next one before it hits you: The KBY Brief
Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.
About this page
Credited to
Dates
Published
Last updated
Was this useful?
Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.
Found this useful? Follow KBY for more like it.
