Docker Registry without authentication leads to docker images download
An exposed Docker Registry API v2 allowed unauthenticated access to its catalog, tags, manifests and blobs. An attacker could download Docker images and read the source code of probably confidential tools.
- Disclosed after 38 days
Description: With the following shodan dork: 'ssl.cert.subject.cn:*.mil country:"US" http.status:200 product:"Docker Registry HTTP API"', you can see an exposed registry server under the CN "██████", which is unreachable from the domain, so I am reporting directly the IP address.
References
https://dreamlab.net/en/blog/post/abusing-exposed-docker-registry-apis/ https://docs.docker.com/registry/spec/api/
Impact
An attacker can download Docker images and read the source code of probably confidential tools.
System Host(s)
████████
Affected Product(s) and Version(s)
Docker Registry HTTP API v2
CVE Numbers
Steps to Reproduce
To get a list of the repositories on the API send the following request:
> GET /v2/_catalog HTTP/1.1
> Host: ████
> Accept: */*
This will return a few repositories hosted on the website. To get any of the repositories files, you will first need to obtain the tag, so you can download the manifest file. For example, we will choose the repo "█████████/█████████". Let's send the following request:
> GET /v2/████████/██████/tags/list HTTP/1.1
> Host: █████████
> Accept: */*
This will give us a json body, which contains the tag we want to download the manifest from, in this case we will have "3.0.1"
Then, to obtain the manifest just send the following request:
> GET /v2/████████/█████/manifests/3.0.1 HTTP/1.1
> Host: █████████
> Accept: */*
Then, just pick any "blobSum" value from the "fsLayers" array from the response we just received with the previous request and send the following request: For example I will now pick: "█████████"
> GET /v2/█████████/██████/blobs/████ HTTP/1.1
> Host: ████████
> Accept: */*
This will make you download a file, which is a .tar.gz archive, and there will be parts of the repo you are downloading.
Suggested Mitigation/Remediation Actions
Implement access control on the registry or do not expose this API unless strictly necessary.
Context
A Docker Registry is the server-side component that stores and serves Docker images. Clients such as docker pull talk to it over the Docker Registry HTTP API, and version 2 of that API exposes a small set of endpoints for listing repositories, listing tags, fetching manifests and downloading individual blobs. When a registry is reachable by anyone and does not enforce authentication or authorisation, those same endpoints that a legitimate client uses become a direct path to the stored image contents.
The target here was a registry server with a certificate common name under a .mil domain, reported through the U.S. Dept Of Defence program. The researcher identified it by its TLS certificate common name, which fell under a .mil domain, but the registry itself was not reachable through that domain name. Because of that, the report was filed directly against the IP address rather than a hostname. The affected product is recorded as Docker Registry HTTP API v2.
Setup
No accounts, roles or credentials were needed. The only tool involved in discovery was Shodan, used with the following dork:
ssl.cert.subject.cn:*.mil country:"US" http.status:200 product:"Docker Registry HTTP API"
This query looks for hosts whose certificate subject common name matches *.mil, geolocated in the US, returning HTTP 200, and fingerprinted by Shodan as a Docker Registry HTTP API. The result was an exposed registry server under the CN shown in the report, which could not be reached via its domain, so the IP address was reported directly. The researcher also referenced two background sources: a blog post on abusing exposed Docker registry APIs and the official Docker Registry API specification.
Finding it
The signal was the combination of a .mil certificate and a Shodan fingerprint identifying the service as a Docker Registry HTTP API, answering with HTTP 200. Since the service was unreachable from the domain, the researcher reported the IP address directly and tested the API endpoints.
Exploitation
Step 1: list the repositories
The first request asks the registry for its catalogue of repositories:
> GET /v2/_catalog HTTP/1.1
> Host: ████
> Accept: */*
/v2/_catalog is the API v2 endpoint that enumerates the repositories the registry holds. According to the report, the response returned a few repositories hosted on the server, giving the researcher names to work with.
Step 2: get the tags for a repository
To download anything from a repository you first need a tag, because the manifest is addressed by tag. The researcher picked the repository █████████/█████████ and sent:
> GET /v2/████████/██████/tags/list HTTP/1.1
> Host: █████████
> Accept: */*
The /v2/<name>/tags/list endpoint returns the tags available for that repository. The response is a JSON body containing the tags, and in this case it included the tag 3.0.1, which is the tag the researcher chose to pull the manifest from.
Step 3: fetch the manifest
With the tag in hand, the next request retrieves the manifest:
> GET /v2/████████/█████/manifests/3.0.1 HTTP/1.1
> Host: █████████
> Accept: */*
The manifest describes the image: among other things it contains an fsLayers array, and each entry in that array carries a blobSum value identifying a layer blob. The response to this request is what supplies the blob identifiers used in the next step.
Step 4: download a layer blob
The researcher picked any blobSum value from the fsLayers array of the manifest response (the report shows the chosen value as █████████) and requested the corresponding blob:
> GET /v2/█████████/██████/blobs/████ HTTP/1.1
> Host: ████████
> Accept: */*
The /v2/<name>/blobs/<digest> endpoint serves the blob content. The response makes the client download a file, which is a .tar.gz archive. Extracting it yields parts of the repository that was downloaded, so the image contents, including files from the image, are now on the attacker's machine.
Root cause
The registry served the Docker Registry HTTP API v2 without any access control. The API endpoints used above, /v2/_catalog, /v2/<name>/tags/list, /v2/<name>/manifests/<tag> and /v2/<name>/blobs/<digest>, are the normal read path for a registry client, and nothing in front of them required authentication or restricted who could call them. Because the service was also reachable from the internet, anyone who found it could walk the same path a legitimate client walks. The report does not describe any additional defence that was present and bypassed; the exposure is the absence of access control on a publicly reachable API.
Impact
An attacker can download Docker images from the registry and read the source code of what are probably confidential tools. The word "probably" matters: the researcher's assessment of confidentiality rests on the nature of the images stored, not on an inventory of their contents. The impact is bounded by what the registry holds and by the steps shown: the report describes downloading the catalogue, tags, manifests and blobs, not pushing or modifying images.
Fix
The suggested remediation is to implement access control on the registry, or not to expose the API unless it is strictly necessary. Either measure closes the path used here: authentication and authorisation stop unauthenticated callers from listing and downloading, and removing public exposure stops them from reaching the API at all.
Variants to test
- Other Shodan fingerprints for registries. Search for hosts fingerprinted as a Docker Registry HTTP API under other certificate patterns or organisations. A positive result is a host that answers
GET /v2/_catalogwith a repository list rather than an authentication challenge. - Registries behind a hostname that does not resolve. As in this report, a certificate CN may point at a service that is not reachable by name. Testing the IP directly can reveal the same API. A positive result is the same catalogue response over the IP.
- Registries that answer
/v2/but restrict the catalogue. If/v2/_catalogis refused but tag and manifest endpoints respond, try known repository names directly. A positive result is atags/listor manifest response for a guessed name. - Registries with authentication on some paths only. Probe each endpoint in the chain (
_catalog,tags/list,manifests,blobs) separately. A positive result is any one of them returning data without credentials while the others are protected.
Hunting notes
The recon signal is a service fingerprint that names the product, combined with a certificate that ties it to an organisation of interest. Shodan's product filter and certificate subject fields make that pairing cheap to search for.
Once a candidate is found, the confirmation is quick: a single unauthenticated GET /v2/_catalog either returns repositories or it does not. From there, the chain of tags/list, manifests/<tag> and blobs/<digest> demonstrates that actual image content, not just metadata, is downloadable. Showing that full chain, ending in a .tar.gz layer, is what turns a fingerprint into demonstrated impact. In this report the researcher also noted that the hostname did not resolve and reported the IP directly, which is worth remembering when a certificate points at a service that the DNS name does not reach.
What happened, in plain words
A server with a certificate under a .mil domain was running a service called a Docker Registry, reported through the U.S. Dept Of Defence program. A Docker Registry is a storage server for Docker images. A Docker image is a packaged bundle of software: the program itself plus the files it needs to run. Developers build these bundles, store them in a registry, and other machines download them from there when they need to run the software.
Normally a registry should ask who you are before it lets you look inside or download anything. This one did not. Anyone on the internet who found it could ask it for a list of everything it stored, then download the contents of those images, which the researcher believed were probably confidential internal tools.
The researcher did not guess the address. He used a search engine for internet-connected devices called Shodan, which keeps a catalogue of what services are running on which addresses. He searched for servers that looked like Docker registries, were tied to a .mil certificate, were in the US and answered with HTTP 200. One result stood out. The server's certificate mentioned a .mil domain name, but that name did not actually lead to the server, so he reported the numeric IP address directly instead.
From there the whole thing was four ordinary web requests, the same four a legitimate Docker client would make. No password, no account, no special tool. That is the bug: a service that should have been private was reachable by anyone and asked no questions.
Some background first
What an API is
An API is the set of addresses and rules a program uses to talk to another program. A useful comparison is a restaurant menu. The kitchen (the server) can cook many things, but the menu (the API) lists exactly what you are allowed to order and how to ask for it. You do not walk into the kitchen yourself; you order from the menu and food comes back.
Here the menu is the Docker Registry HTTP API, version 2. It has a small number of entries: one to list the repositories, one to list the tags of a repository, one to fetch a manifest, and one to download a blob. Each of those words is explained as it comes up below.
What a Docker Registry is
A registry is the warehouse where Docker images are kept. When a developer runs a command like docker pull, their computer contacts a registry and asks for a particular image. The registry hands it over. The same server can hold many images for many projects, organised into repositories.
What a repository, a tag and a manifest are
- A repository is one named collection of images, a bit like a folder for one piece of software. Repositories can have a slash in the name, such as
team/tool, which groups them. - A tag is a label on one particular version inside that repository, such as
3.0.1. It is how you say which version you want, the way a book edition number tells you which printing to buy. - A manifest is the description file for one image. It does not contain the software itself; it lists what the image is made of. Among other things it holds an
fsLayersarray, which is a list of the image's layers. - A layer is one slice of an image. Images are built in slices stacked on top of each other, and each slice is stored as a separate file called a blob. Each layer in the manifest is identified by a
blobSumvalue, which is a long identifier for that slice.
So the path to real content is: repository, then tag, then manifest, then blob. Each step gives you the information you need for the next one.
What the vulnerability class means
This report is filed under improper access control. Access control is the part of a system that decides who is allowed to do what: a bouncer at a door checking names against a list. When access control is missing, the door is simply open. Nothing clever was bypassed here. The registry was reachable from the internet and did not require anyone to identify themselves, so the normal read path of the API was open to all.
Finding the server
The researcher did not need an account, a role or any credentials. The only tool used to find the target was Shodan, with this search query, called a dork:
ssl.cert.subject.cn:*.mil country:"US" http.status:200 product:"Docker Registry HTTP API"
Line by line, this query says:
ssl.cert.subject.cn:*.milasks for servers whose TLS certificate has a subject common name ending in.mil. A TLS certificate is the digital ID card a secure website presents to prove who it claims to be, and the common name (CN) is the name written on that card.country:"US"limits results to the United States.http.status:200means the server answered a web request with the success code 200, so it is alive and responding normally.product:"Docker Registry HTTP API"means Shodan has already recognised the service as a Docker registry.
The result was a registry server whose certificate named a .mil domain. The catch was that the server was unreachable from the domain, so the researcher reported the IP address directly. He therefore reported the IP address directly. An IP address is the numeric address of a machine on the internet, the equivalent of a street address when the name on the letter will not get you there.
The researcher also cited two background sources: a blog post about abusing exposed Docker registry APIs, and the official Docker Registry API specification.
Getting in, step by step
Step 1: ask for the list of repositories
The first request asks the registry to list everything it holds:
> GET /v2/_catalog HTTP/1.1
> Host: ████
> Accept: */*
Line by line:
GETis the web method for "please give me this". It only reads; it does not change anything./v2/_catalogis the API v2 address that returns the catalogue of repositories. This is the menu page that lists every dish in the kitchen.Host: ████names the server being asked. The actual value is redacted in the report.Accept: */*tells the server the client will accept a response in any format.
Why this step: before you can download anything you have to know what exists. The response, according to the report, listed a few repositories hosted on the server, which gave the researcher names to work with.
Step 2: ask for the tags of one repository
To download from a repository you first need a tag, because the manifest is requested by tag. The researcher picked the repository █████████/█████████ and sent:
> GET /v2/████████/██████/tags/list HTTP/1.1
> Host: █████████
> Accept: */*
Line by line:
GETagain means read only./v2/████████/██████/tags/listis the endpoint that lists the tags for the named repository. The repository name is redacted in the report.HostandAcceptdo the same jobs as before.
Why this step: the manifest is addressed by tag, so you cannot ask for a manifest until you know which tag exists. The response is a JSON body, meaning a block of structured text that a program can read easily, and it contained the tag 3.0.1. That is the version the researcher chose to pull.
Step 3: fetch the manifest
With the tag in hand, the next request retrieves the manifest:
> GET /v2/████████/█████/manifests/3.0.1 HTTP/1.1
> Host: █████████
> Accept: */*
Line by line:
GETreads the manifest./v2/████████/█████/manifests/3.0.1asks for the manifest of the named repository at tag3.0.1.HostandAcceptare unchanged.
Why this step: the manifest is the description of the image, and it is where the identifiers of the actual content live. Its fsLayers array lists the layers, and each entry carries a blobSum value naming one layer blob. The response to this request is what supplies the identifiers used in the next step.
Step 4: download a layer
The researcher picked any blobSum value from the fsLayers array of the manifest response, shown in the report as █████████, and requested the matching blob:
> GET /v2/█████████/██████/blobs/████ HTTP/1.1
> Host: ████████
> Accept: */*
Line by line:
GETreads the blob./v2/█████████/██████/blobs/████is the endpoint that serves blob content for the named repository and the chosen identifier. The values are redacted in the report.HostandAcceptare unchanged.
Why this step: this is the point where real content leaves the server. The response makes the client download a file, which is a .tar.gz archive, a compressed bundle of files. Extracting it yields parts of the repository that was downloaded, so files from inside the image are now on the attacker's machine. That is the difference between seeing a menu and walking out with the food.
Why it worked
The registry served the Docker Registry HTTP API v2 with no access control at all. The four endpoints used above, /v2/_catalog, /v2/<name>/tags/list, /v2/<name>/manifests/<tag> and /v2/<name>/blobs/<digest>, are the ordinary read path a legitimate Docker client follows. Nothing in front of them asked who was calling or limited who could. Because the service was also reachable from the internet, anyone who found it could walk the same path a legitimate client walks. No extra defence was present and bypassed; the exposure is simply the absence of access control on a publicly reachable API.
What an attacker could do with it
An attacker can download Docker images from the registry and read the source code of what are probably confidential tools. The word "probably" matters: the researcher's judgement about confidentiality rests on the kind of images stored, not on an inventory of their contents. The impact is limited by what the registry holds, and by the steps shown, which only read data. The report describes downloading the catalogue, tags, manifests and blobs, not pushing or changing images.
How to fix it
The suggested remediation is to implement access control on the registry, or not to expose the API unless it is strictly necessary. Either measure closes the path used here. Authentication and authorisation stop unauthenticated callers from listing and downloading, and removing public exposure stops them from reaching the API at all.
Other places to look
- Other Shodan fingerprints for registries. Search for hosts fingerprinted as a Docker Registry HTTP API under other certificate patterns or organisations. A positive result is a host that answers
GET /v2/_catalogwith a repository list rather than an authentication challenge. - Registries behind a hostname that does not resolve. As in this report, a certificate CN may point at a service that is not reachable by name. Testing the IP directly can reveal the same API. A positive result is the same catalogue response over the IP.
- Registries that answer
/v2/but restrict the catalogue. If/v2/_catalogis refused but tag and manifest endpoints respond, try known repository names directly. A positive result is atags/listor manifest response for a guessed name. - Registries with authentication on some paths only. Probe each endpoint in the chain (
_catalog,tags/list,manifests,blobs) separately. A positive result is any one of them returning data without credentials while the others are protected.
Notes for hunters
The recon signal is a service fingerprint that names the product, combined with a certificate that ties it to an organisation of interest. Shodan's product filter and certificate subject fields make that pairing cheap to search for.
Once a candidate is found, confirmation is quick: a single unauthenticated GET /v2/_catalog either returns repositories or it does not. From there, the chain of tags/list, manifests/<tag> and blobs/<digest> shows that actual image content, not just metadata, is downloadable. Showing that full chain, ending in a .tar.gz layer, is what turns a fingerprint into demonstrated impact. In this report the researcher also noted that the hostname did not resolve and reported the IP directly, which is worth remembering when a certificate points at a service that the DNS name does not reach.
Glossary
- Access control: the part of a system that decides who may do what, like a bouncer checking names at a door.
- API: the defined set of addresses and rules one program uses to talk to another, like a restaurant menu.
- Authentication: proving who you are, for example with a password or a key.
- Authorisation: deciding what an identified person is allowed to do.
- Blob: one stored chunk of data, here a single layer of a Docker image.
- blobSum: the identifier of a layer blob, listed in the manifest.
- Common name (CN): the name written on a TLS certificate as the identity it belongs to.
- Docker: software for packaging and running applications in containers.
- Docker image: a packaged bundle of a program and the files it needs to run.
- Docker Registry: the server that stores and serves Docker images.
- Docker Registry HTTP API v2: version 2 of the web interface a registry exposes for listing and downloading images.
- Endpoint: one specific address in an API that does one job.
- fsLayers: the array in a manifest that lists the image's layers.
- GET: the web method that asks a server to return something without changing it.
- Host header: the part of a request that names which server is being asked.
- HTTP 200: the status code meaning a request succeeded.
- IP address: the numeric address of a machine on the internet.
- JSON: a structured text format that programs can read easily.
- Layer: one slice of a Docker image, stored as a separate blob.
- Manifest: the description file of an image, listing its layers.
- Repository: a named collection of images for one piece of software.
- Shodan: a search engine that catalogues internet-connected devices and the services they run.
- Shodan dork: a search query written for Shodan.
- Tag: a label on one version inside a repository, such as
3.0.1. - TLS certificate: the digital ID card a secure server presents to prove its identity.
.tar.gz: a compressed archive file containing other files.