SSRF: send arbitrary POST requests into local networks
The Prometheus integration in GitLab allowed an attacker to make arbitrary POST requests to internal network addresses by supplying a malicious service account JSON with a token_credential_uri pointing to a local server. This could be used to interact with internal services, such as a Docker daemon, potentially leading to file read or other impacts.
GitLab
Originally disclosed on GitLab
- Fixed in 3 months
- Disclosed after 3 months
HackerOne report #1037411 by yvvdwf on 2020-11-18, assigned to @dcouture:
Report | How To Reproduce
Report
Hello,
Prometheus integration service allows to issue any POST requests into local network.
Steps to reproduce
- In any existing project (or create a new one), goto Settings/Intergrations/Prometheus
- Setting the following parameters:
- Active: check
- API URL:
https://gitlab.com(or any url) - Google IAP Audience Client ID:
test(or any string) - Google IAP Service Account JSON:
{"token_credential_uri": "http://localhost:1234/arbitrary-query?x=y", "private_key": 512}
- Click "Test" button, gitlab will hit
localhost:1234(e.g., open a web server at port 1234 to receive the requests)
Impact
The SSRF allows attackers to issue arbitrary POST requests into local network. The impact will be different, depending on which services are running on the local network. For example, if there exists a docker daemon that is listening on localhost:2375, then attackers may read any files by issuing a POST request to build an image from remote dockerfile. With your permission, I will try to discover gitlab.com .
Output of checks
This bug happens on GitLab.com
Impact
The SSRF allows attackers to issue arbitrary POST requests into local network. The impact will be different, depending on which services are running on the local network. For example, if there exists a docker daemon that is listening on localhost:2375, then attackers may read any files by issuing a POST request to build an image from remote dockerfile. With your permission, I will try to discover gitlab.com .
How To Reproduce
Please add reproducibility information to this section:
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 application did not validate or restrict the URL provided in the Google IAP Service Account JSON, allowing it to point to internal addresses.
Impact
The SSRF allows attackers to issue arbitrary POST requests into local network, which could lead to reading files or other actions depending on internal services.
What the attacker needed
Access to a GitLab project; ability to configure Prometheus integration
How it was found
- Go to Settings/Integrations/Prometheus in any project.
- Set Active, API URL to any URL, Google IAP Audience Client ID to any string, and Google IAP Service Account JSON with a token_credential_uri pointing to a local server.
- Click the Test button, and GitLab will send a request to the specified local address.
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.
This is a server-side request forgery (SSRF) bug. The GitLab server was tricked into sending requests to internal addresses that an attacker cannot reach directly. By setting a special field in a configuration, the attacker made GitLab send a POST request to a local server, which could be dangerous if internal services are running.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.