Credentials Stored in Files on Disk
Passwords, keys or tokens are kept in readable files on the host, such as scripts, configuration files and notes, where other users or an attacker can recover them.
| Severity | High |
| CVSS 3.1 | 7.8 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 8.5 CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-313: Cleartext Storage in a File or on Disk |
| OWASP Top 10 | A06:2025 Insecure Design |
| MITRE ATT&CK | T1552.001 Credentials In Files, T1078 Valid Accounts |
| Category | Information Disclosure |
Description
Credentials are stored in clear text, or in a form that can be reversed without any secret, in files on the host's local disk that can be read by users or processes that should not have them, and anyone who can read the files obtains the credentials and the access that goes with them. Common examples are scripts and batch files with embedded passwords; application and service configuration files holding database connection strings, API keys or cloud access keys; deployment answer files such as unattend.xml left behind after installation; shell and PowerShell command history; backup copies of configuration files; and documents, spreadsheets and text files in which users record passwords. Values that are only base64-encoded, as in many answer files, are no better protected than plain text.
Where the credentials belong to a service account, a local or domain administrator, a database or a cloud account, a low-privileged user or an attacker with a foothold on the host can escalate privileges and move to other systems without exploiting any vulnerability, and activity carried out with valid credentials is harder to distinguish from legitimate use. The impact depends on the privileges of the accounts concerned and on who can read the files: it is greatest when the files are readable by all users and when the same credentials are used on other systems.
The weakness is identified once access to the host has been obtained, by searching readable file systems for credential patterns, manually or with tools such as winPEAS, linPEAS, Seatbelt or LaZagne, and by checking who can read the files found. It covers files on the host itself; credentials found on file shares, in SYSVOL scripts and in directory attributes are reported under their own findings.
Remediation
Remove credentials from files and give the processes that need them a protected source instead:
- Search the affected host, and others built from the same image or managed by the same scripts, for stored credentials, and remove them from scripts, configuration files, answer files, history files and documents. Delete deployment answer files, such as those under
C:\Windows\Panther, once the build is complete. - Change every credential that was found, since it must be presumed known, and review the recent use of the accounts concerned.
- Supply secrets to scripts, services and applications through a mechanism designed for it: a secrets manager such as HashiCorp Vault, Azure Key Vault or AWS Secrets Manager; group Managed Service Accounts for Windows services and scheduled tasks; managed identities or instance roles for cloud workloads; or the operating system's protected credential store where a secret must stay on the host.
- Where a configuration file has to contain a secret, restrict its permissions to the account that uses it and to administrators, and use the platform's protected configuration where one exists, such as encrypted sections in an ASP.NET
web.configfile. - Provide users with an approved password manager so that passwords are not kept in documents.
- Add secret scanning to build pipelines, and periodic scans of hosts, so that new occurrences are found early.
Confirm the fix by repeating the search with the same tools and checking that the credentials found earlier no longer work.
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.