Skip to content
Misconfiguration Disclosed report Beginner CVE-2023-23914

CVE-2023-23914: HSTS ignored on multiple requests

curl's HSTS support was not carried over between serial transfers on the same command line, so a later URL given as plain HTTP was fetched insecurely even though an earlier response had told curl to upgrade that host to HTTPS. An attacker able to intercept traffic could therefore read or alter that later request in clear text.

nyymi Follow

Originally disclosed on HackerOne

Bounty$480 Low View original
  • Triaged in 7 days
  • Fixed in 9 days
  • Paid in 9 days
  • Disclosed after 9 days

Summary by the program

CVE-2023-23914: HSTS ignored on multiple requests Project curl Security Advisory, February 15 2023

VULNERABILITY curl's HSTS functionality fail when multiple URLs are requested serially.

Using its HSTS support, curl can be instructed to use HTTPS instead of using an insecure clear-text HTTP step even when HTTP is provided in the URL. This HSTS mechanism would however suprisingly be ignored by subsequent transfers when done on the same command line because the state would not be properly carried on.

Reproducible like this:

curl --hsts "" https://curl.se http://curl.se The first URL returns HSTS information that the second URL fails to take advantage of.

We are not aware of any exploit of this flaw.

INFO This is a curl command line issue and does not affect libcurl.

This flaw was introduced in commit 7385610d0c7, which was shipped enabled by default from commit d71ff2b9db566b3f in curl 7.77.0.

The Common Vulnerabilities and Exposures (CVE) project has assigned the name CVE-2023-23914 to this issue.

CWE-319: Cleartext Transmission of Sensitive Information

Severity: Low

Full Security Advisory: https://curl.se/docs/CVE-2023-23914.html

The report

curl's HSTS functionality fail when multiple URLs are requested serially.

Using its HSTS support, curl can be instructed to use HTTPS instead of using an insecure clear-text HTTP step even when HTTP is provided in the URL. This HSTS mechanism would however suprisingly be ignored by subsequent transfers when done on the same command line because the state would not be properly carried on.

Impact

Bypass intended security control.

The original report as published on HackerOne, by nyymi. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

curl is a command line tool and library for transferring data with URLs. One of its features is HSTS support: when enabled, curl can be told to upgrade a URL from clear-text HTTP to HTTPS, so that a request written as http:// is not sent over an insecure channel if the host is known to require HTTPS. The HSTS state is learned from responses and is meant to persist across transfers.

The issue described here is CVE-2023-23914, published in a curl security advisory dated 15 February 2023. It concerns the curl command line tool only: the advisory states that libcurl is not affected. The weakness is classified as CWE-319, Cleartext Transmission of Sensitive Information, with a severity of Low. The report was filed against the curl repository on GitHub through the Internet Bug Bounty program and was disclosed on 24 February 2023.

Setup

The advisory does not describe any special account, role or tooling. The precondition is a curl build with HSTS support enabled by default, which the advisory says has been the case since curl 7.77.0. The flaw was introduced in commit 7385610d0c7 and shipped enabled by default from commit d71ff2b9db566b3f.

The reproduction uses a single curl invocation with two URLs on the same command line, and an empty HSTS file supplied with --hsts.

Finding it

The researcher observed that curl's HSTS functionality fails when multiple URLs are requested serially. The first transfer can return HSTS information, but that state is not carried on to subsequent transfers in the same command line, so the HSTS mechanism is ignored by those later transfers. The advisory describes this as surprising, because the state is not properly carried on between transfers.

In other words, the feature works as intended for the first URL and then silently stops applying for the rest of the command line.

Exploitation

Step 1: request two URLs serially with HSTS enabled

The advisory gives the following reproduction:

Bash
curl --hsts "" https://curl.se http://curl.se

--hsts "" enables HSTS handling with an empty HSTS file, so no state is loaded from disk at the start. The first URL, https://curl.se, is fetched over HTTPS and, per the advisory, returns HSTS information. The second URL, http://curl.se, is written as clear-text HTTP and should be upgraded to HTTPS using the HSTS information learned from the first transfer.

Step 2: observe that the second transfer ignores the learned state

According to the advisory, the first URL returns HSTS information that the second URL fails to take advantage of. The second transfer therefore fails to take advantage of the HSTS information learned from the first, because the state was not carried on between the two transfers.

The advisory does not include the actual output of the command, so the exact response lines are not reproduced here.

Root cause

The advisory attributes the behaviour to HSTS state not being properly carried on between transfers when multiple URLs are requested serially on the same command line. The HSTS mechanism is ignored by subsequent transfers for that reason. The flaw was introduced in commit 7385610d0c7 and became enabled by default from commit d71ff2b9db566b3f in curl 7.77.0.

The advisory does not go into the code-level detail of where the state is lost, so the precise mechanism is not stated. It is a curl command line issue and does not affect libcurl.

Impact

The impact stated in the report is a bypass of an intended security control. When a user relies on HSTS to avoid a clear-text HTTP step, a later URL on the same command line does not benefit from the HSTS information supplied by the earlier transfer.

The advisory hedges the practical risk: it says the maintainers are not aware of any exploit of this flaw. The severity is Low, and the weakness is CWE-319, Cleartext Transmission of Sensitive Information.

Fix

The advisory does not describe the code change that fixed the issue. It points to the full security advisory at https://curl.se/docs/CVE-2023-23914.html for details. What the report does establish is the scope of the flaw: the problem is in the curl command line tool's handling of HSTS state across serial transfers, and libcurl is not affected.

Variants to test

These follow from the behaviour described in the advisory and are worth trying on other command line clients that keep per-session security state:

  1. Supply two URLs on one command line where the first teaches the client a security policy (HSTS, and by analogy other upgrade or pinning state) and the second would rely on it. A positive result is that the second transfer does not apply the policy learned from the first.
  2. Repeat the same pair of URLs in the opposite order, or with the policy-teaching URL last, to see whether ordering changes the outcome. A positive result is inconsistent application of the policy depending on position.
  3. Start with an empty state file and with a pre-populated one, to see whether persisted state behaves differently from state learned during the run. A positive result is that only in-run state is lost.
  4. Chain more than two URLs so that several later transfers depend on state from the first. A positive result is that all subsequent transfers ignore the learned state.

Hunting notes

This kind of bug hides in the gap between per-transfer and per-session state: a client that correctly applies a security policy within one transfer but fails to carry the state into the next. During recon, the signal is a tool that documents session-wide security behaviour (upgrade rules, pinning, cached policy) and offers a way to run several requests in one invocation. The advisory's reproduction is minimal, a single command with two URLs and an empty state file, which is the kind of check that is quick to run against any client with similar features.

The report showed impact by framing the behaviour as a bypass of an intended security control and by giving a reproducible command. The advisory itself notes that no exploit is known, and the severity was rated Low, which is consistent with a logic flaw whose practical exploitation depends on how the tool is used.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

curl is a small program you run from a text window (a terminal or command prompt) to fetch things from the internet. It is often used by developers and system administrators, and it is also built into many other programs as a reusable piece of code called a library. That library version is called libcurl.

One of curl's features is called HSTS. HSTS stands for HTTP Strict Transport Security. To understand it, you first need to know the difference between two ways of talking to a website:

  • HTTP is the plain, unencrypted way. Anyone sitting between your computer and the website (for example on the same coffee shop Wi-Fi) can read or change what travels back and forth. Think of it as a postcard: the postal workers can read it.
  • HTTPS is the encrypted way. The two ends agree on a secret code, and anyone in the middle sees only scrambled data. Think of it as a sealed envelope.

A website can tell a browser or a tool: "from now on, always talk to me over HTTPS, even if someone writes my address with plain HTTP." That instruction is the HSTS policy. The client remembers it for a while and silently upgrades later plain HTTP requests to HTTPS.

curl supports this. When HSTS is switched on, curl can take a URL written as http:// and quietly use https:// instead, if it has learned that the site requires it. The learned policy is meant to stick around for the rest of the run.

The bug in this report is that the policy does not stick around when you give curl more than one URL in the same command. The first URL teaches curl the HSTS policy, but the second URL fails to take advantage of it. The security control the user asked for is silently skipped.

This issue is tracked as CVE-2023-23914. A CVE is a public catalogue number for a known security flaw, so people can refer to the same bug unambiguously. The flaw was published in a curl security advisory dated 15 February 2023. It affects only the curl command line program, not the libcurl library. It is classified as CWE-319, Cleartext Transmission of Sensitive Information, which is a category name meaning "data that should have been protected was sent in the clear". The severity is Low. The report was filed against the curl project on GitHub through the Internet Bug Bounty program and was disclosed on 24 February 2023.

Context

curl is a command line tool and library for transferring data with URLs. A URL is the address of something on the internet, like https://curl.se. The command line tool is the curl program you type into a terminal; the library is the same engine packaged so other software can call it.

HSTS support means curl can be told to upgrade a URL from clear-text HTTP to HTTPS. "Clear-text" means unencrypted, readable by anyone in the path. The upgrade happens automatically: you write http://, and curl sends the request over https:// instead, provided it knows the host requires HTTPS.

curl learns the HSTS policy from responses it receives. A website can send a special header (a small piece of metadata attached to a response) saying "remember that I require HTTPS". curl is supposed to store that and apply it to later transfers in the same session.

The problem here is that the stored policy is not carried from one transfer to the next when several URLs are requested one after another on the same command line.

Setup

No special account, role or extra tooling is needed. The only precondition is a curl build with HSTS support enabled by default. The advisory says that has been the case since curl 7.77.0. A version number like 7.77.0 identifies a particular release of the software.

The flaw was introduced in a specific code change, called a commit, identified as 7385610d0c7. A commit is a recorded edit to the project's source code, with a unique identifier. The feature became enabled by default from another commit, d71ff2b9db566b3f.

The reproduction uses one curl command with two URLs on the same line, plus an empty HSTS file supplied with the --hsts option. The HSTS file is where curl can save and load remembered policies between runs. Passing an empty value means: start with no remembered policies at all, so anything curl learns during this run must come from the responses in this run.

Finding it

The researcher noticed that curl's HSTS handling fails when several URLs are requested one after another. The first transfer can return HSTS information, but that information is not carried into the following transfers on the same command line. Those later transfers therefore ignore the HSTS mechanism.

The advisory calls this surprising, because the state is not properly carried on between transfers. In plain terms: the feature works for the first URL and then quietly stops working for the rest of the command.

Exploitation

Step 1: request two URLs serially with HSTS enabled

The advisory gives this reproduction:

Bash
curl --hsts "" https://curl.se http://curl.se

Line by line:

  • curl is the program being run.
  • --hsts "" switches on HSTS handling and points it at an empty HSTS file. The two double quotes contain nothing, so no saved policies are loaded at the start. This matters because it forces curl to rely only on what it learns during this run, which is exactly what the test is about.
  • https://curl.se is the first URL. It is written with HTTPS, so it is fetched over the encrypted channel. The advisory says the first URL returns HSTS information, which curl is supposed to remember.
  • http://curl.se is the second URL. It is written with plain HTTP. Because curl has just learned that this host requires HTTPS, it should upgrade this request to HTTPS before sending it.

Why this step: putting both URLs on one command line is the situation the researcher suspected was broken. The first URL is the teacher, the second is the student that should benefit from the lesson.

Step 2: observe that the second transfer ignores the learned state

According to the advisory, the first URL returns HSTS information that the second URL fails to take advantage of. The second transfer therefore fails to take advantage of the HSTS information the feature is supposed to apply, because the state was not carried between the two transfers.

The advisory does not include the actual output of the command, so the exact response lines are not shown here.

Root cause

The advisory attributes the behaviour to HSTS state not being properly carried on between transfers when multiple URLs are requested serially on the same command line. That is why the HSTS mechanism is ignored by the later transfers.

The flaw was introduced in commit 7385610d0c7 and became enabled by default from commit d71ff2b9db566b3f in curl 7.77.0.

The advisory does not go into the code-level detail of where the state is lost, so the precise mechanism is not stated. What is clear is the scope: this is a curl command line issue and does not affect libcurl.

Impact

The impact stated in the report is a bypass of an intended security control. A bypass means the protection is still configured and still looks active, but it does not actually apply. When a user relies on HSTS to avoid a clear-text HTTP step, a later URL on the same command line does not benefit from the HSTS information supplied by the earlier transfer.

The advisory is careful about real-world risk: it says the maintainers are not aware of any exploit of this flaw. The severity is Low, and the weakness is CWE-319, Cleartext Transmission of Sensitive Information.

Fix

The advisory does not describe the code change that fixed the issue. It points to the full security advisory at https://curl.se/docs/CVE-2023-23914.html for details. What the report does establish is the scope of the flaw: the problem is in the curl command line tool's handling of HSTS state across serial transfers, and libcurl is not affected.

Variants to test

These follow from the behaviour described in the advisory and are worth trying on other command line clients that keep security state for a whole session:

  1. Supply two URLs on one command line where the first teaches the client a security policy (HSTS, and by analogy other upgrade or pinning state) and the second would rely on it. A positive result is that the second transfer does not apply the policy learned from the first.
  2. Repeat the same pair of URLs in the opposite order, or with the policy-teaching URL last, to see whether ordering changes the outcome. A positive result is inconsistent application of the policy depending on position.
  3. Start with an empty state file and with a pre-populated one, to see whether persisted state behaves differently from state learned during the run. A positive result is that only in-run state is lost.
  4. Chain more than two URLs so that several later transfers depend on state from the first. A positive result is that all subsequent transfers ignore the learned state.

Hunting notes

This kind of bug hides in the gap between per-transfer and per-session state: a client that correctly applies a security policy within one transfer but fails to carry the state into the next. During recon, the signal is a tool that documents session-wide security behaviour (upgrade rules, pinning, cached policy) and offers a way to run several requests in one invocation. The advisory's reproduction is minimal, a single command with two URLs and an empty state file, which is the kind of check that is quick to run against any client with similar features.

The report showed impact by framing the behaviour as a bypass of an intended security control and by giving a reproducible command. The advisory itself notes that no exploit is known, and the severity was rated Low, which is consistent with a logic flaw whose practical exploitation depends on how the tool is used.

Glossary

  • curl: A command line program and library for transferring data with URLs.
  • libcurl: The library form of curl, used by other software rather than typed by a person.
  • URL: The address of something on the internet, such as https://curl.se.
  • HTTP: The plain, unencrypted protocol used to fetch web content.
  • HTTPS: The encrypted version of HTTP, where the two ends agree on a secret code so others cannot read the traffic.
  • Clear-text: Unencrypted data that anyone in the network path can read.
  • HSTS: HTTP Strict Transport Security, a policy by which a site tells a client to always use HTTPS for it.
  • HSTS file: A file where curl can save and load remembered HSTS policies between runs.
  • --hsts: The curl option that switches on HSTS handling and points it at an HSTS file.
  • Header: A small piece of metadata attached to an HTTP request or response.
  • Transfer: One fetch of one URL by curl.
  • Serially: One after another, in sequence, rather than at the same time.
  • State: Information a program remembers from earlier actions and uses later.
  • Session: The whole run of a program, from start to finish, across several transfers.
  • CVE: A public catalogue number for a known security flaw.
  • CWE-319: A category name meaning cleartext transmission of sensitive information.
  • Severity: A rating of how serious a flaw is, here Low.
  • Advisory: An official notice from a project describing a security flaw.
  • Commit: A recorded edit to a project's source code, identified by a unique string.
  • Bypass: Getting past a protection so that it no longer applies, even though it is still configured.
  • Exploit: A concrete way to take advantage of a flaw.
  • Recon: The early phase of looking at a target to understand what it does and where to test.
  • Pinning: A policy that ties a site to a specific identity or certificate so a different one is rejected.

More by nyymi

View all

51 more disclosed reports, best first.

More from Internet Bug Bounty

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.