Skip to content
Misconfiguration Disclosed report Intermediate CVE-2022-43551CVE-2022-42916

CVE-2022-43551: Another HSTS bypass via IDN

curl stored the pre-IDN-conversion hostname in its HSTS cache, so a hostname containing an ideographic full stop that Nameprep converts to a dot was cached under a different key than the one used for later lookups. An attacker could therefore reach a site over plain HTTP even though HSTS had been recorded for it.

kurohiro Follow

Originally disclosed on HackerOne

  • Triaged in 13 days
  • Fixed in 53 days
  • Disclosed after 53 days

Summary:

I found an issue similar to CVE-2022-42916 again. Since the phenomenon is the same, I will describe the same as last time.

HSTS checks are bypassed if any character in the IDN convert(Nameprep) to a '.' for example"。"(UTF-8:E38082). I think there are other characters that become ".(UTF-8:2E)" as a result of converting with IDN.

This is because the host name before IDN conversion is used when writing to the HSTS cache.

Steps To Reproduce:

[add details for how we can reproduce the issue]

  1. Start from a state where there is no entry for the access destination host name in the HSTS cache
  2. curl -v --hsts hsts.txt https://accounts.google%E3%80%82com
  3. curl -v --hsts hsts.txt http://accounts.google%E3%80%82com

Result of 3.

C:\test\curl-7.86.0-win64-mingw\bin>curl -v --hsts hsts.txt http://accounts.google%E3%80%82com --head
*   Trying 142.250.206.237:80...
* Connected to accounts.google縲Dom (142.250.206.237) port 80 (#0)
> HEAD / HTTP/1.1
> Host: accounts.google.com
> User-Agent: curl/7.86.0
> Accept: */*
>

If you execute 3. after executing the below, you will access the site with HTTPS. curl -v --hsts hsts.txt https://accounts.google.com

I use this in a Windows environment.

I checked the HSTS cache after executing 2. and found the host name before IDN conversion.

# Your HSTS cache. https://curl.se/docs/hsts.html
# This file was generated by libcurl! Edit at your own risk.
.accounts.google。com "20231029 15:57:29"

I think the problem is in http.c:line 3727. data->state.up.hostname is the hostname of the IDN unconverted.

    CURLcode check =
      Curl_hsts_parse(data->hsts, data->state.up.hostname,
                      headp + strlen("Strict-Transport-Security:"));

Impact

HSTS bypass.

The original report as published on HackerOne, by kurohiro. 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 HSTS cache is written using the raw, pre-IDN hostname while lookups use the normalised hostname, so equivalent names do not match.

What the attacker needed

HSTS cache lacks an entry for the host

The fix

The HSTS cache should probably use the IDN-converted hostname, as the raw one appears to be the problem.

How it was found

  1. Ensure the target host has no entry in the HSTS cache.
  2. Request the host over HTTPS using a hostname with a character that IDN conversion turns into a dot, so an HSTS entry is written.
  3. Request the same host over plain HTTP and observe that the request is sent unencrypted instead of being upgraded.

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 rule a site sends telling browsers and tools to always use the encrypted HTTPS version. curl keeps a list of such hosts, but it saved the name in its original form while later checking a converted form, so the two never matched and the plain HTTP request went through.

What is Misconfiguration?

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.

More by kurohiro

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.

Security misconfiguration

The lesson behind this report.

Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.