Skip to content
Business logic Write-up Intermediate

Finding vulnerabilities in curl 7.83.0 without reading a single-line of C code

Three logic flaws in curl's cookie, URL and HSTS handling were found: a cookie could be set for a trailing-dot top-level domain, a percent-encoded slash in a hostname was decoded into the stored URL, and HSTS was bypassed by a trailing dot. An attacker could inject cookies, leak cookies to their own host through a proxy, or force plain HTTP connections open to interception.

haxatron1 Follow

Published on haxatron.gitbook.io

curl is a popular command-line tool used by many people around the world to make requests to a server. It also offers a library which developers can use to build applications that communicate with servers.

Haxatron (@Haxatron1), on haxatron.gitbook.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the cookie, URL and HSTS checks compared hostnames as plain strings, so a trailing dot or a percent-encoded slash slipped past the checks that decide which domain a cookie belongs to and whether HTTPS is required.

Impact

An attacker could plant cookies for other sites, leak a victim's cookie to their own server through a proxy, and force an HSTS-protected host to be reached over plain HTTP, though the cookie leak needs the Secure attribute to be absent and a proxy in use.

What the attacker needed

Curl 7.82.0 or later affected versions; victim uses a proxy (cookie leak); cookie without Secure attribute; attacker controls a hostname

The fix

The vulnerabilities were fixed by the maintainer after being reported.

How it was found

  1. Set a cookie for a top-level domain written with a trailing dot and observe that curl accepts it.
  2. Send a proxy URL containing a percent-encoded slash and inspect the request curl sends to the proxy.
  3. Observe that curl derives the hostname with the slash decoded and stores that malformed URL.
  4. Have a user with a cookie for a domain visit an attacker hostname crafted to end with that domain, through a proxy, and see the cookie sent to the attacker.
  5. Put a hostname with a trailing dot into the HSTS cache and request it over HTTP to see curl skip the HTTPS upgrade.

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 write-up has not been written yet. The Original tab links to the source.

curl is a program that fetches web pages and is used inside many other programs. Cookies are small pieces of data a site stores in your client to remember who you are, and HSTS is a rule that says 'always use the encrypted version of this site'. The author found that small mistakes in how curl handled dots and encoded characters in names let an attacker plant cookies, leak them, or downgrade a connection to unencrypted HTTP.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by haxatron1

View all

1 more disclosed report, best first.

More from Internet Bug Bounty (curl)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.