Container Registry Exposure
Anonymous pull leaks your code. Anonymous push replaces it.
What Is Container Registry Exposure?
A registry that allows anonymous pull hands your source, your config and your deployed artifact to anyone who guesses the repository name. Anonymous push lets an attacker overwrite the tag you are about to ship, and the pipeline notices nothing. You'll pull a production image, rebuild it with an implant, push it back under the same release tag, and task that implant inside the running service. Then you'll require authentication, scope push, mark release tags immutable, and verify the deployed image by digest rather than tag.
What You'll Learn in Container Registry Exposure
- Recognize that anonymous pull on a private repository hands an attacker your source, your configuration, and your build layers
- Trace a poisoned deployment to an attacker who rebuilt the production image and pushed it back under the same release tag
- Configure a registry policy that requires authentication to pull and scopes push to the repositories a pipeline actually builds
- Mark release tags immutable so an existing tag cannot be repointed at content nobody tested or reviewed
- Verify a deployed image by comparing its digest against the digest the pipeline recorded, since a tag moves but a digest cannot
Container Registry Exposure — Training Steps
-
Scan for a public repo
Bob does not target Quenmoor by name. He scans self-hosted registries for ones that answer without a login, then enumerates their repositories to find one left readable. Quenmoor's registry answers, and one repository stands out.
-
A private repo left open
Bob scans self-hosted registries for repositories he should not be able to reach. Quenmoor's registry answered him without asking who he was, and one repository stands out: an internal dispatch service.
-
Public, and writable
This is an internal service, but its access policy is wide open. Bob reads the two settings that matter to him.
-
Pull it anonymously
No credentials, no membership, no request for access. Bob points Docker at the registry and pulls the production image straight down.
-
Read their production config
The image is not just code. It carries the configuration it runs with, baked into a layer. Bob starts a container from it and reads that file straight out.
-
Rebuild it with a backdoor
Reading the image was theft; overwriting it is control. Because he pulled their real production image, Bob rebuilds straight from it and adds a single layer. This is the Dockerfile.
-
The layer he added
Everything else is their image, unchanged. One RUN turns it into a foothold that ships with every deploy.
-
Tag it as their release
Bob builds the poisoned image and tags it with the exact name Quenmoor deploys from, so the registry will treat it as the production release.
-
Push a poisoned tag
Reading the image is theft. Overwriting it is control. Bob rebuilds the image with a backdoor in its entrypoint and pushes it back to the exact tag Quenmoor deploys from. The registry accepts it without asking who he is.
-
What the push bought him
The next deploy rolled Bob's tag into production, and the layer he added phoned home from inside the running service. He does not have to reach Quenmoor from outside anymore: his code is the service.
Security Framework Coverage
CWE
- CWE-306 Missing Authentication for Critical Function
- CWE-732 Incorrect Permission Assignment for Critical Resource
MITRE ATT&CK
- T1525 Implant Internal Image
CIS Controls
- CIS 6 Access Control Management
- CIS 2 Inventory and Control of Software Assets
NIST CSF
- PR.AT-02 Individuals in specialized roles are provided with awareness and training so that they possess the knowledge and skills to perform relevant tasks with cybersecurity risks in mind
- PR.AA Identity Management, Authentication, and Access Control
- ID.AM Asset Management