Skip to content
DoS Disclosed report Intermediate CVE-2024-9681

CVE-2024-9681: HSTS subdomain overwrites parent cache entry

A bug in curl's HSTS cache handling causes a subdomain's HSTS policy to overwrite the parent domain's expiration time. A malicious subdomain can extend the parent domain's HSTS period, potentially causing a denial of service if the parent intended to revert to HTTP.

newfunction Follow

Originally disclosed on HackerOne

  • Triaged in 38 hours
  • Fixed in 30 days
  • Disclosed after 30 days

Summary:

Suppose my HSTS cache file has the following content:

.domain.com "20241107 01:02:03"
.sub.domain.com "unlimited"

Now, I connect to https://sub.domain.com/. Suppose this domain now sets a HSTS policy: Strict-Transport-Security: max-age=15768000 ; includeSubDomains. Surprisingly my HSTS cache file now becomes:

.domain.com "unlimited"
.sub.domain.com "20250408 00:26:19"

While the HSTS policy for "sub.domain.com" is correctly updated, the HSTS expiration time for "domain.com" is mistakenly set to be the previous expiration time for "sub.domain.com".

If I have multiple levels of subdomains in my HSTS cache, the situation is more confusing. Suppose my HSTS cache is:

.com "20241108 01:02:03"
.badssl.com "20260408 04:39:00"

Now I connect to https://hsts.badssl.com/index.html. After that, the HSTS cache becomes:

.com "20260408 04:39:00"
.hsts.badssl.com "20250408 04:49:30"

Steps To Reproduce:

  • curl version: curl 8.11.0-DEV (x86_64-pc-linux-gnu) libcurl/8.11.0-DEV OpenSSL/3.0.2 libpsl/0.21.0, curl source HEAD commit: 86d5c2651d3ea8af316eff2a2452ae61413c66ba

  • Also reproducible in curl 8.10.1 release version.

    1. Create a text file testhsts.txt with the following content: .badssl.com "20241101 00:25:31" (less than 1 month expiration time)
    2. Run curl -v --hsts ./testhsts.txt "http://hsts.badssl.com/index.html". Check the content of testhsts.txt
    3. Run curl -v --hsts ./testhsts.txt "http://hsts.badssl.com/index.html" again. Check the content of testhsts.txt again.
  • After step 2, the content of testhsts.txt is:

.badssl.com "20241101 00:25:31"
.hsts.badssl.com "20250408 04:39:00"
  • After step 3, the content of testhsts.txt is:
.badssl.com "20250408 04:39:00"
.hsts.badssl.com "20250408 04:40:01"

You can see the expiration time of .badssl.com is set incorrectly.

Supporting Material/References:

None

Impact

For shared subdomains, i.e. different subdomains are controlled by different users, a malicious subdomain can influence the HSTS expiration time of the parent domain. By my tests, a subdomain can only increase the expiration time of its parent domain, but can't shorten it. A malicious subdomain can cause a denial of service of its parent domain, if the parent domain only plans to support HSTS for a short period of time, and wants to revert to plaintext http after a while. By exploiting this bug, the malicious subdomain can set a very long max-age for itself, and this bug can cause curl to overwrite the parent domain's HSTS expiration time to be very long.

The original report as published on HackerOne, by newfunction. 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 a logic error in curl's HSTS cache update where the parent domain's expiration is overwritten by the subdomain's previous value.

Impact

A malicious subdomain can extend the parent domain's HSTS expiration, potentially causing a denial of service if the parent intended to revert to HTTP.

What the attacker needed

Control of a subdomain; victim uses curl with HSTS cache

How it was found

  1. Create a text file with an HSTS entry for a parent domain with a short expiration.
  2. Run curl with the HSTS file against a subdomain that sets its own HSTS policy.
  3. Check the file: the parent domain's expiration is incorrectly updated.
  4. Run curl again and observe the parent domain's expiration changes again.

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.

HSTS is a security feature that tells browsers to always use HTTPS for a site. When a subdomain sets an HSTS policy, curl mistakenly updates the parent domain's expiry time instead of keeping them separate. This means a bad subdomain can force the parent domain to stay on HTTPS longer than intended, which could break things if the parent wanted to go back to HTTP.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by newfunction

View all

9 more disclosed reports, best first.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.