SSRF vulnerability in gitlab.com via project import.
The project import feature blocked obvious loopback addresses such as [redacted] and localhost, but alternative numeric notations of the same address still reached internal services. An attacker could use these forms to probe internal ports through the import error messages.
Originally disclosed on HackerOne
- Triaged in 2 months
- Fixed in 8 months
- Disclosed after 8 months
Dear GitLab bug bounty team,
Summary
It appears as though the fix to !17286 can be easily bypassed. You have blocked the usage of http://127.0.0.1, http://localhost/, etc., but http://0177.1/ and http://0x7f.1/, for instance, can still be used to scan internal ports.
Error importing repository http://0177.1:22/ into {username}/{project} - Cloning into bare repository '[REPOS PATH]/{username}/{project}.git'...
fatal: unable to access 'http://0177.1:22/': Recv failure: Connection reset by peer
Admittedly, you have restricted the use of certain ports, but I still believe this needs to be fixed.
Fix
Block decimal, octal and hex localhost notation.
Best regards, Ed
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 blocklist matched only literal hostname strings instead of resolving and validating the actual IP address.
Impact
An attacker could scan internal ports on the GitLab host, though the text notes that some ports were already restricted.
What the attacker needed
Ability to create or import a project
How it was found
- Start a project import that accepts a repository URL.
- Supply a loopback address written in an alternative numeric notation.
- Read the import error output to learn whether the internal port responded.
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.
When a server fetches a URL for you, it can be tricked into contacting machines on its own private network. The site tried to block this by rejecting the usual names for 'this machine', but the same address can be written in other number formats, so the check was bypassed.
What is SSRF?
The server can be made to fetch an address the attacker chooses, reaching internal services, cloud metadata or other customers' data.