
Hardcoded secrets are credentials written directly into source code, configuration files, scripts or container images. Examples include passwords, API keys, access tokens, database connection strings and private keys. MITRE’s weakness catalog lists the use of hard-coded credentials as CWE-798.
MITRE ATT&CK lists searching files and source code for stored credentials as technique T1552.001.
A single leaked cloud key can give access to data, systems and computing resources, and can lead to cryptojacking or a supply chain attack. The OWASP Secrets Management Cheat Sheet recommends keeping secrets in a dedicated vault, scanning code before commits and rotating any secret that has been exposed. Deleting the line is not enough: an exposed secret must be revoked. Services that watch for secrets in public code help find leaks in repositories the organization does not control.
Sources: CWE-798: Use of Hard-coded Credentials, OWASP Cheat Sheet Series: Secrets Management