Skip to content
SSRF Disclosed report Advanced CVE-2019-5464

Server Side Request Forgery mitigation bypass

GitLab's webhook URL validation failed to apply DNS rebinding protection when domain resolution initially failed, allowing an attacker to send requests to internal network addresses. An attacker could use this to access sensitive internal services, including cloud metadata endpoints.

mclaren650sspider Follow

Originally disclosed on HackerOne

  • Triaged in 2 days
  • Fixed in 46 days
  • Paid in 46 days
  • Disclosed after 10 months

Summary

This vulnerability allows attacker to send arbitrary requests to local network which hosts GitLab and read the response. This is possible due to flawed DNS rebinding protection.

The attack is possible due to flaw here: https://gitlab.com/gitlab-org/gitlab-ce/blob/108c3cf16bed5733ffae086fb62c226961356560/lib/gitlab/url_blocker.rb#L59

The validate function performs DNS lookup to check whether the IP address of a domain belongs to the local network. If the IP address belongs to the local network, the validate function raises an error and no HTTP request is sent. Furthermore, validate returns URI as well as the IP address of the domain to protect against DNS rebinding attacks. However, if validate encounters an error while resolving the domain (for example, the domain does not resolve), the DNS rebinding protection is not applied.

Steps to reproduce

  1. Create a webhook for a repository on GitLab.com. Use the URL http://990.hacker1.xyz. It may return error but let's ignore it now.
  2. Wait about 10 seconds and test webhook by clicking on "Test" and "Push events".
  3. After the hook has executed, you should see content of http://169.254.169.254 returned.

Wait about 15 seconds between testing attempts, otherwise it may not work due to DNS caching.

The code for proof-of-concept DNS server which hosts hacker1.xyz is attached. The PoC uses a chain of CNAME records to prevent caching.

What is the current bug behavior?

The outgoing HTTP requests from webhooks can be sent to the internal network.

What is the expected correct behavior?

It is expected that HTTP requests cannot be sent to the internal network.

Relevant logs and/or screenshots

F519096 Content of http://169.254.169.254

F519095 Content of http://127.0.0.1

Output of checks

This bug happens on GitLab.com

Impact

Attacker can use SSRF to access sensitive information on the internal network. Furthermore, SSRF in Google Cloud can be leveraged to Remote Code Execution depending on the setup. Publicly disclosed $25,000 #341876 describes a way to gain root access to Google Cloud server via a SSRF vulnerability.

Attachments

Screen_Shot_2019-06-29_at_15.37.14.png
Screen_Shot_2019-06-29_at_15.37.14.png From the original on HackerOne
Screen_Shot_2019-06-29_at_15.36.41.png
Screen_Shot_2019-06-29_at_15.36.41.png

The original report as published on HackerOne, by mclaren650sspider. 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

Impact

An attacker could use SSRF to access sensitive information on the internal network, and in Google Cloud environments this could potentially lead to remote code execution depending on the setup.

What the attacker needed

A GitLab.com account; ability to create a webhook; control of a domain with DNS server

The fix

HTTP requests should not be able to be sent to the internal network.

How it was found

  1. Create a webhook for a repository on GitLab.com using a URL that points to a domain controlled by the attacker.
  2. Wait about 10 seconds, then test the webhook by clicking 'Test' and 'Push events'.
  3. After the hook executes, observe that the content of the cloud metadata endpoint 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 webhook is a feature that makes the server send a request to a URL you provide. The server tried to block requests to internal addresses, but if the domain did not resolve at first, the protection was skipped. An attacker could then make the server talk to internal services and read their responses.

What is SSRF?

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.

More by mclaren650sspider

View all

1 more disclosed report, best first.

More from GitLab

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Server-side request forgery (SSRF)

The lesson behind this report.

The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.