# Secrets retained in container build artifacts

A build places confidential inputs in image history, layers or artifacts available outside their intended audience.

**Candidate CWE:** [CWE-522](https://cwe.mitre.org/data/definitions/522.html)

## Test hypothesis

Build only a reviewed fixture recipe with a synthetic marker in the suspected secret input. Inspect the resulting owned image history/layers and compare a build using the documented secret mechanism.

## Evidence required

Build recipe and commit, exact image digest, marker location, image-reader access and the secure build comparison.

## Rule out false positives

Fake sample strings, public non-secret build metadata, or a secret mount that is not persisted into the final accessible artifact.

## Playbook and command references

- [Infrastructure configuration: from repository default to deployed impact](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/modules/infrastructure-config.html) — Trace IaC, charts, Compose and image packaging into supported deployments, including exposed services and sensitive artifacts.

[Find the associated command snippets](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/commands.html?q=Infrastructure%20configuration%3A%20from%20repository%20default%20to%20deployed%20impact)

## Referenced by these target playbooks

[OSS & self-hosted](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/oss.html) · [Cloud & containers](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/cloud.html)

## 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](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/attack.html#T1552-001) — **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.

## Primary references

- [Docker build secrets](https://docs.docker.com/build/building/secrets/)
- [Docker image history](https://docs.docker.com/reference/cli/docker/image/history/)

[Back to the complete vulnerability catalog](https://bug-bounty-field-manual.kmahshooq.chatgpt.site/vulnerabilities.html)
