Hard-coded product credentials
A reusable credential is embedded in source, history, a release, or a default configuration. Distinguish a shared built-in credential from an accidentally committed deployment credential when assigning the weakness.
Candidate CWE: CWE-798
Test hypothesis#
Run gitleaks git ./repo --redact=100 --report-format json --report-path ./evidence/secrets.json against a local clone, then inspect surrounding code and supported setup. Check whether a shipped synthetic lab accepts the documented shared default. For a discovered real token, establish ownership and exposure from context; ask the owner to validate and rotate it rather than using it.
Evidence required#
Repository path and commit, first/last observed exposure, credential purpose, shipped/default use where proved, and a redacted fingerprint. Never attach the complete credential. Separate proven lab authentication from unknown validity of a deployment secret. Apply CWE-798 only where the credential is embedded in product authentication or outbound credential use. For accidental repository disclosure, use the separate exposed-repository-secret entry and classify the actual exposure root cause.
Rule out false positives#
Test keys, intentionally public identifiers, revoked values, example-only placeholders, and fixtures not shipped in the product. An entropy match alone is insufficient.
Playbook and command references#
- OSS lab: pin, install, prove, reset — Turn an eligible release into a repeatable synthetic environment with preserved versions, realistic controls, and an explicit reset recipe.
- Source review: entry point to protected operation — Trace attacker control and authorization through handlers, services, queues, and sensitive operations; promote only reachable violations of a stated invariant.
- CI and releases: trace untrusted input into privileged work — Audit workflow events, shell interpolation, untrusted builds, artifact consumers, and release identity as one privilege chain.
Find the associated command snippets
Referenced by these target playbooks#
Report checklist#
- Capture the affected version, configuration, identities, and object ownership.
- Preserve a valid baseline and a negative control.
- Reproduce the forbidden data access, action, or state change on controlled fixtures.
- Explain the intended security rule and why the observed behavior violates it.
- State prerequisites, uncertainty, cleanup, and the smallest demonstrated impact.
Conditional ATT&CK mapping#
- T1552.001 · Unsecured Credentials: Credentials In Files — Only if: The tested path retrieves credentials from insufficiently protected configuration, source, log, archive, or other files; retain only redacted evidence and location details. Not established by: A high-entropy string, sample credential, or accessible file without authentication material is insufficient. Reading arbitrary non-secret data is a different behavior.