Unauthenticated CI lint API may lead to information disclosure and SSRF
The unauthenticated CI lint API accepted remote includes in submitted YAML, so anyone could make the GitLab instance fetch a URL of their choosing. An attacker could use this to reach internal services or to reveal the instance's origin IP address and user agent.
GitLab
Originally disclosed on GitLab
- Fixed in 57 days
- Disclosed after 57 days
HackerOne report #1059596 by myster on 2020-12-15:
Report | How To Reproduce
Report
HI!
CI Lint API (https://docs.gitlab.com/ee/api/lint.html) allows anonymous access for anyone to validate yaml syntax which in itself is not really an issue however use of remote includes may result in an abuse of this unauthenticated API endpoint.
Scenario 1:
An administrator enables internal requests to use Webhooks with internal services assuming its safe to do because all users are part of the organization and can be trusted.
This would also allow an attacker to abuse the CI Lint Api with remote includes to perform internal network requests.
PoC .gitlab-ci.yml:
include:
remote: 'http://127.0.0.1:9100/b.yml'
curl request:
curl -s -H 'Content-Type: application/json' https://redacted/api/v4/ci/lint --data '{ "include_merged_yaml": true, "content": "include:\n remote: 'http://127.0.0.1:9100/b.yml'" }'
response (if port is open):
"Included file `http://127.0.0.1:9100/b.yml` does not have valid YAML syntax!"
Scenario 2:
Let's assume that internal requests are blocked. Even in such a scenario, following risks are present:
-
Abuse of the Gitlab instance as a proxy to port scan remote targets (I know there are a lot of such proxies out there, but still there should at least be an option to disallow this)
-
Disclosure of origin IP address + User agent of Gitlab instance when its running behind a load balancer or services like Cloudflare for DDoS protection.
Therefore, I think this endpoint should not be public by default and enforcing authentication might be a good idea allowing a toggle to disable it if one is aware of potential risks here.
Thanks!
Impact
- Origin IP address disclosure
- Unauthenticated SSRF when an admin whitelists internal endpoints for Authenticated users
How To Reproduce
Please add reproducibility information to this section:
Proposal
https://gitlab.com/gitlab-org/gitlab/-/issues/294178#note_484606184
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 lint endpoint was reachable without authentication and processed remote includes by fetching the supplied URL server-side, without restricting destinations.
Impact
An attacker could use the instance as a proxy to scan remote targets and could disclose the origin IP address and user agent when the instance sits behind a load balancer or a DDoS protection service; internal SSRF was possible when an administrator had whitelisted internal endpoints.
What the attacker needed
No account needed; admin has whitelisted internal endpoints (for internal SSRF)
The fix
The endpoint should not be public by default; authentication should be enforced, with a toggle to disable it for those aware of the risks.
How it was found
- Send a request to the CI lint endpoint with a YAML body containing a remote include pointing at an internal address.
- Enable merged YAML in the request so the include is processed.
- Read the response: an error about invalid YAML indicates the port is open.
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.
The CI lint endpoint checks whether a pipeline configuration file is valid, and it did this without asking anyone to log in. That configuration format can point at another file on a remote address, so the server fetched whatever address the sender supplied. When a server fetches a URL chosen by an outsider, it can be tricked into contacting machines on its own private network that outsiders cannot reach.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.