Credentials in SYSVOL or NETLOGON Scripts
Logon, startup or deployment scripts in SYSVOL or NETLOGON contain user names and passwords that every domain user can read.
| Severity | High |
| CVSS 3.1 | 8.1 CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N Open in the calculator |
| CVSS 4.0 | 8.6 CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-798: Use of Hard-coded Credentials |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1552.001 Credentials In Files, T1078.002 Domain Accounts, T1078.003 Local Accounts |
| Category | Information Disclosure |
Description
Scripts and files stored in the SYSVOL share, including the NETLOGON share that points to its scripts folder, contain credentials in readable form. Typical examples are logon scripts that map drives with net use and an explicit user name and password, startup scripts that set the local administrator password with net user, PowerShell that builds a credential from a plain-text string with ConvertTo-SecureString -AsPlainText, and batch files that run tools such as PsExec with a password on the command line. Copies of installation, answer and configuration files, and old versions of scripts left in policy folders, are other sources. Passwords that are Base64-encoded or otherwise obscured are equally exposed, because the script itself must be able to recover them.
SYSVOL is replicated to every domain controller and every authenticated user can read it by default, so any domain user can recover these credentials and sign in as the accounts concerned. These are often accounts with elevated rights: a local administrator password applied by a startup script gives administrative access to every computer that runs it, and accounts used to join computers to the domain, map shares or run deployment tools frequently have wide permissions on servers or in the directory. Scripts are rarely reviewed once they work, so a credential written there often stays available for years, and because logon scripts run everywhere and are rarely changed, it is usually still valid; changing it needs coordination with every system that depends on the script.
The issue is identified by reading the scripts and files in SYSVOL and NETLOGON and searching them for terms such as password, pwd, /user: and AsPlainText, manually or with tools such as Snaffler or NetExec's share spidering modules, then confirming that the credentials found are valid. Passwords in Group Policy Preferences XML files are a related issue that is reported separately.
Remediation
- Change the password of every account whose credentials were found, and assume that others have already read them.
- Remove the credentials from the scripts and files, and delete obsolete scripts, backup copies and installation files from SYSVOL and NETLOGON. Make each change once and let replication carry it to every domain controller.
- Redesign the tasks so that they need no stored secret: map drives with the user's own credentials, run computer startup tasks as the computer account, use Windows LAPS for local administrator passwords, and use group managed service accounts for services and scheduled tasks.
- Where a task must run under a separate identity, retrieve the secret at run time from a secrets management service that authorises the specific computer or user, rather than storing it in the script.
- Review new scripts before they are placed in SYSVOL, and add a periodic search for credentials there to routine directory reviews.
Confirm the fix by repeating the search of SYSVOL and NETLOGON and testing that the credentials found previously no longer authenticate.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.