Skip to main content
cd ../config-traps
risk/register/sysvol-scripts-expose-embedded-credentials-to-all-domain-users.html
Active Directory Group Policycritical severityActive Directory

SYSVOL Scripts Expose Embedded Credentials to All Domain Users

Severity
critical
Reviewed
30 Jul 2026
Remediation
~20 minutes
Overview

Startup and logon scripts containing embedded credentials in SYSVOL replicate to every domain controller via NETLOGON shares. Domain users can read these scripts directly from the sysvol path, extracting service account passwords, API keys, and database connection strings that administrators embedded for automated tasks.

At a glance

Unsafe setting
Hardcoded credentials stored in Group Policy startup/logon scripts within SYSVOL directories.
Failure trigger
Domain users browse NETLOGON share and extract embedded passwords from readable script files.
Blast radius
All domain users can access service account passwords, API keys, and database credentials embedded in scripts.
Recommended control
Replace hardcoded credentials with Group Managed Service Accounts and encrypted Group Policy Preferences.

The Trap

Group Policy startup and logon scripts stored in SYSVOL contain hardcoded service account passwords, database connection strings, or API keys embedded directly in batch files, PowerShell scripts, or VBScript. These credentials authenticate automated tasks like mapped drive connections, service installations, or application configuration during user logon or computer startup.

The Default State

When administrators create Group Policy Objects with Computer ConfigurationPoliciesWindows SettingsScripts (Startup/Shutdown) or User ConfigurationPoliciesWindows SettingsScripts (Logon/Logoff), the Group Policy Management Console stores script files in %SYSVOL%domain.comPolicies{GPO-GUID}MachineScripts or UserScripts directories. These directories inherit SYSVOL’s default NTFS permissions: Authenticated Users with Read access. The NETLOGON share maps to SYSVOLScripts, making every script readable by any domain user through \domain.comNETLOGON browsing.

The Blast Radius

Any authenticated domain user can enumerate and download every startup/logon script containing embedded credentials. Service account passwords stored in clear text enable lateral movement across systems where those accounts hold local administrator rights or database access. API keys embedded in scripts grant unauthorised access to cloud services, file shares, or third-party applications. Database connection strings expose credentials for SQL Server instances, Oracle databases, or application backends. Since SYSVOL replicates to every domain controller, credential exposure spans the entire Active Directory forest with no audit trail of who accessed which scripts.

The Lead Mechanic Fix

Replace hardcoded credentials in SYSVOL scripts with Group Policy Preferences for mapped drives using cpassword encryption, or deploy credentials through secure channels. For service installations, use Group Managed Service Accounts (gMSAs) with Set-ADServiceAccount and Install-ADServiceAccount cmdlets. For application configuration requiring database access, store connection strings in protected registry keys using Group Policy Administrative Templates with encrypted values. Implement script signing with Set-AuthenticodeSignature and configure execution policy to AllSigned via GPO Computer ConfigurationAdministrative TemplatesWindows ComponentsWindows PowerShell. Audit existing SYSVOL scripts using Get-ChildItem -Path “\domain.comSYSVOL” -Recurse -Include “*.bat”,”*.cmd”,”*.ps1″,”*.vbs” | Select-String -Pattern “password|pwd|secret|key|connection” to identify credential exposure.

03

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.

Control to implement

Replace hardcoded credentials with Group Managed Service Accounts and encrypted Group Policy Preferences.

Validate the vendor-specific syntax in official documentation before applying it.

04

Verify, 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.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.