CVE-2022-30115: HSTS bypass via trailing dot
curl's HSTS cache lookup failed to match a hostname written with a trailing dot, so a URL for a site listed in the HSTS cache was fetched over plain HTTP instead of being upgraded to HTTPS. An attacker able to get a victim to use such a URL could strip the HTTPS protection HSTS is meant to guarantee.
- Triaged in 3 hours
- Fixed in 8 days
- Disclosed after 8 days
curl allows users to load a HSTS cache which will cause curl to use HTTPS instead of HTTP given a HTTP URL for a given site specified in the HSTS cache.
If the trailing dot is used, the HSTS check will be bypassed.
If a user has a preloaded hsts.txt:
# Your HSTS cache. https://curl.se/docs/hsts.html
# This file was generated by libcurl! Edit at your own risk.
accounts.google.com "20230503 08:47:52"
Doing the following:
curl --hsts hsts.txt http://accounts.google.com.
Will cause accounts.google.com to be loaded over HTTP
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://accounts.google.com/">here</A>.
</BODY></HTML>
This issue has been raised in other HTTP clients before such as in https://bugs.chromium.org/p/chromium/issues/detail?id=461481 and https://www.mozilla.org/en-US/security/advisories/mfsa2015-13/
Impact
HSTS bypass
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 lookup compared the hostname literally, so a trailing dot made the name not match the stored entry and the upgrade to HTTPS was skipped.
What the attacker needed
Curl with an HSTS cache entry for the site; victim uses a URL with a trailing dot
How it was found
- Prepare an HSTS cache file containing the target site.
- Request the site's HTTP URL with a trailing dot added to the hostname.
- Observe that curl loads the site over HTTP rather than upgrading to HTTPS.
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 tells a program to always use HTTPS for a listed site. curl keeps such sites in a cache file. Adding a dot at the end of the site name made curl not recognise it, so it used plain HTTP.
What is Misconfiguration?
Settings left unsafe: exposed panels, open storage buckets, debug modes, default credentials.