Export
The link always opens the latest version of this page.
Ask an AI about it
Open in ChatGPTA new chat that reads this entry from the site Open in ClaudeThe same, in ClaudeShare the link instead of a file, and they will always see the latest version.
Files are a snapshot of today. The live page has anything newer.
CWE-798: Use of Hard-coded Credentials
The product contains hard-coded credentials for its own inbound authentication or outbound communication.
Definition
CWE-798 is a weakness where a product embeds credentials (passwords, API keys, tokens, or other authentication material) directly in its source code, configuration files, or compiled binaries.
Consequences
Hard-coded credentials enable unauthorized-access1 to systems and services. Attackers who obtain the code or binary can extract these credentials and bypass authentication mechanisms entirely2. This creates pathways for both unauthorized access and privilege escalation3.
Risk Factors
The severity of CWE-798 depends on the scope of credential exposure. Credentials embedded in widely-distributed software (client applications, firmware, containers) pose greater risk than those in restricted server code. Once extracted, hard-coded credentials typically grant the same access level as legitimate users, and rotation becomes difficult across all deployed instances.
Mitigation
- Store credentials in external configuration systems (environment variables, secure vaults, key management services) separate from code
- Use runtime credential injection rather than compile-time embedding
- Implement credential rotation policies
- Scan source code and binaries for embedded secrets during development and CI/CD
- Apply principle of least privilege to embedded credentials when unavoidable
Detection
Hard-coded credentials can be identified through:
- Static code analysis and secret scanning tools
- Binary analysis and string extraction
- Configuration file review
- Access pattern monitoring for anomalous credential usage
In the news 5
- Schneider Electric Easergy MiCOM Px40 Series · CISA Advisories
- Flow Neuroscience FL-100 · CISA Advisories
- CareCam Pro IP Cameras · CISA Advisories
- SAP Patches CVSS 9.9 NetWeaver ABAP Flaw That Could Expose or Modify Data · The Hacker News
- Claude Code's “Don't Ask Again” File Exposes Passwords and Keys in 1,122 Public Copies on GitHub · The Hacker News
Sign in for the full story cards: summaries, tags and starring.