scanrub
Password in Configuration Filelow prioritypartial coverage

Password in Config File

3 min read 8 reports analyzed ScanRub Research
Share

Summary

This is CWE-260, a specific and very concrete instance of the broader cleartext-storage problem: a real password, sitting in plaintext, inside a configuration file that's part of the deployment rather than the compiled source. It's distinct from a hard-coded credential baked into source code in one practical way: config files (.env, web.config, application.properties, config.yml) are frequently deployed alongside an application rather than compiled into it, which means they're also frequently the thing left accidentally reachable over the web when a deployment script or web server configuration doesn't explicitly block access to them. The password itself might be for a database, an internal service, a third-party API, or the application's own admin account, but the common thread is always the same: a real, working credential sitting in a plaintext file that a simple, direct HTTP request can retrieve.

◈ flow diagram
Source Code …Hard-Coded S…Direct Authe…Protected Sy…

Top Affected Components / Targets

  • .env files left in the web root of Node, PHP, and Python deployments
  • web.config in ASP.NET deployments, which can contain database connection strings with embedded credentials
  • application.properties and application.yml in Spring Boot deployments
  • Generic config.json or config.yml files following common naming conventions across frameworks

Common Attack Vectors

  • Probe conventional configuration file paths directly at the web root and common subdirectories: /.env, /web.config, /application.properties, /application.yml, /config.yml, /config.json
  • Where a file is reachable, scan its content specifically for password, secret, and connection-string patterns rather than assuming reachability alone is the complete finding

Common Payloads

  • Direct requests to /web.config, /.env, /application.properties, /application.yml, /config.yml, /config.json, and equivalent conventional paths for the fingerprinted framework

Detection Strategy

Probe a curated list of conventional configuration file paths, prioritized by the target's fingerprinted framework where possible (an ASP.NET target is far more likely to expose web.config than application.properties, for instance), and for anything that returns real file content, scan it specifically for password- and secret-shaped values rather than treating the file's mere reachability as the complete finding. A file that's reachable but genuinely empty of credentials is still worth flagging as unnecessary exposure, but at markedly lower severity than one containing a real, working password.

Tip: Testing tools that run these checks in parallel across every discovered endpoint can cut the time required substantially compared to fully manual testing, as long as they confirm findings with more than one signal to keep the false-positive rate down.

False-Positive Notes

A config file containing only placeholder or example values (DB_PASSWORD=changeme, password: your_password_here) should be flagged as an exposure risk (the file shouldn't be reachable regardless) but not scored as a confirmed credential leak the way a file with a real, structurally plausible secret would be.

How to Test

Manual Testing Methodology

Here is a systematic approach to identifying Password in Config File vulnerabilities in a target application.

Step 1: Reconnaissance and Surface Mapping

Before testing, map all input vectors that could be affected. Identify parameters, headers, cookies, and request bodies that interact with the vulnerable component. A proxy such as Burp Suite or OWASP ZAP, paired with normal browsing of the target, is usually enough to build this list.

Step 2: Baseline Request

Send a legitimate request and record the normal response: status code, content length, response time, and any identifying tokens. This baseline matters because it's what you'll compare later responses against once payloads are involved.

Step 3: Payload Injection

Inject test payloads into each identified input vector one at a time. Start with benign detection payloads before escalating to anything that could actually trigger the vulnerability. For Password in Config File specifically, search publicly reachable source (client-side JS bundles, mobile app binaries, public repositories, exposed .git directories) for API keys, connection strings, and hard-coded passwords, and separately try any vendor-published default credentials against the target's login and admin interfaces.

Step 4: Response Analysis

Compare the response against your baseline, looking specifically for a live credential or key found in source that successfully authenticates against the corresponding service, or a default credential pair that logs in without being changed.

Step 5: Confirmation

Once a potential vulnerability is detected, confirm it with at least a few independent test cases to rule out coincidence. Document the exact request and response as proof. For Password in Config File, a confirmed finding typically means showing that attacker-controlled input changes the application's behavior in a way that matters for security, not just that a payload was reflected somewhere harmless.

Real-World Impact

Real-World Impact

Hard-coded and weakly-protected credentials give an attacker a direct path to whatever the credential guards — a database, an internal API, a cloud account, or the application itself — without needing to find or exploit a code-level bug at all. A secret committed to source control remains exploitable even after it's later removed, since it persists in git history indefinitely unless the repository is actively scrubbed and the credential rotated.

Default credentials left in place after deployment are a perennial finding for exactly the same reason: they require no discovery beyond checking the vendor's published defaults, and they're routinely still valid in production.

Weakly hashed or reversibly "encrypted" passwords compound the damage of any other breach — a database dump that would otherwise only expose hashes needing significant offline cracking effort instead hands over plaintext-equivalent credentials immediately, and because of password reuse, that damage extends well beyond the breached application itself.

Prevention & Remediation

Prevention and Secure Coding

Preventing Password in Config File takes a defense-in-depth approach — no single control below is sufficient alone, but together they close off both the primary path and the most common bypasses.

Secrets manager, not source control. Store credentials, API keys, and cryptographic keys in a dedicated secrets manager (Vault, cloud KMS, or equivalent) and inject them at runtime — never commit them to a repository, config file, or container image.

Rotate anything ever exposed. A credential that was ever committed, even briefly, should be treated as compromised and rotated — removing it from the latest commit does not remove it from history.

No shipped default credentials. Force a credential-setup step on first run rather than shipping a default username/password that some deployments will never change.

Modern password hashing, always. Hash passwords with bcrypt, scrypt, or Argon2 with a per-user salt — never store them in plaintext or with reversible encryption, and never with an unsalted or fast general-purpose hash like unsalted SHA-256.

Automated secret-scanning in CI. A pre-commit or CI secret-scanner catches an accidental credential commit before it reaches a shared branch, which is far cheaper than a post-hoc rotation.

Frequently Asked Questions

What is Password in Config File?
This is CWE-260, a specific and very concrete instance of the broader cleartext-storage problem: a real password, sitting in plaintext, inside a configuration file that's part of the deployment rather than the compiled source.
How common is Password in Config File in bug bounty reports?
Scanrub's research corpus for this playbook is built from 8 disclosed HackerOne reports in this category, synthesized for detection and prevention guidance rather than reproduced verbatim.
How do I test for Password in Config File?
Map every input vector, record a baseline response, then inject targeted test payloads one field at a time and compare the response for timing, length, error, or reflection differences from that baseline. The "How to Test" section above walks through the full methodology for this specific vulnerability class.
What is the single most effective fix for Password in Config File?
Store every credential and key in a dedicated secrets manager injected at runtime, never in source control or a shipped default — and rotate anything that was ever committed.
Weekly security research

New vulnerability playbooks, tool updates, and bug bounty insights - delivered to your inbox. No spam.

Unsubscribe anytime. We respect your inbox.
Press ⌘K to search×