Skip to content
SSRF Disclosed report Advanced

Abusing URL Parsers by long schema name

The curl library's URL parser mishandles long scheme names, causing a mismatch between the scheme and the host. An attacker could bypass a whitelist and perform server-side request forgery against internal infrastructure.

d4d Follow

Originally disclosed on HackerOne

Informational View original
  • Disclosed after 36 days

Summary:

There is known technique to exploit inconsistency of URL parser and URL requester logic to perform Server Side Request Forgery attack. Firstly it was presented by Orange Tsai at A New Era Of SSRF Exploiting URL Parser. Firstly I found the familiar issue at old versions of curl, but exploit did not seems works at latest releases. But now I'm ready to share new exploit of issue.

Steps To Reproduce:

Schema parser logic of curl library is vulnerable to "Abusing URL Parsers". Malicious user can use this weakness to bypass whitelist protection and perform Server Side Request Forgery against targets, that use vulnerable version of library.

  1. curl "ssrf3.twowaysyncapp.tk://google.com" Protocol "ssrf3.twowaysyncapp.tk" not supported or disabled in libcurl
  2. curl "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.twowaysyncapp.tk://google.com" Host aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.twowaysyncapp.tk requested

Supporting Material/References:

Details about attack presented at https://btlfry.gitlab.io/owasp/#/21 The main difference at new version of library subdomain name should be much longer.

  • F1102530

Impact

Incorrect schema parser logic will allow malicious user to bypass protection mechanism and get access to the internal infrastructure of affected web servers.

Attachments

curl.png
curl.png From the original on HackerOne

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

Root cause

Likely the URL parser does not correctly handle very long scheme names, leading to a mismatch between the parsed scheme and host.

Impact

An attacker could bypass a whitelist and access internal infrastructure of affected web servers.

What the attacker needed

Vulnerable version of curl library; attacker can control a URL

How it was found

  1. Run curl with a short custom scheme and a host; curl reports the protocol is not supported.
  2. Run curl with a very long custom scheme and a host; curl treats the long scheme as the host and makes a request.

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 URL has a scheme (like http) and a host (like example.com). The curl tool decides which protocol to use based on the scheme. This report shows that if the scheme name is very long, curl can get confused and treat part of the scheme as the host, which might let an attacker reach internal systems that should be blocked.

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 from curl

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.