Skip to content
Crypto Disclosed report Advanced CVE-2021-22924

TLS session cache case-folds CA paths and bypasses the active trust profile

curl's TLS session cache compares peer keys case-insensitively, so two CA files whose paths differ only in letter case are treated as the same trust profile. An application reusing a multi handle or shared session cache across per-transfer CA profiles could then reuse a TLS session and send credentials to a server the active CA profile does not trust.

1rhino2 Follow

Originally disclosed on HackerOne

  • Disclosed after 16 hours

curl 8.21.0 case-folds the entire TLS session-cache peer key, so two distinct CA files whose Unix paths differ only by case can share a TLS session ticket.

At lib/vtls/vtls_scache.c:723, curl_strequal() compares keys that include case-sensitive CA, CRL, and issuer paths, even though docs/internals/TLS-SESSIONS.md says lookup uses exactly the same peer key.

Run the attached poc-casefolded-scache.py: each of its two vulnerable passes first trusts Trust.pem, switches to an unrelated trust.pem, logs SSL reusing session, sends Authorization: Bearer VICTIM_CANARY, receives two HTTP 200 responses, and exits 0.

cert controls: good_rc=0 bad_rc=2
run1 case-only bad CA: rc=0 reused=True canary_sent=True http_200=2
run2 case-only bad CA: rc=0 reused=True canary_sent=True http_200=2
control different-name bad CA: rc=60 reused=False canary_sent=False http_200=1

The control uses the same unrelated CA under Different.pem; curl performs a full certificate handshake, exits 60, and never sends the canary, while changing the known-key lookup to strcmp() produces the same safe result.

Current master 2687751471c04e07a9c5da78338569d97aff7fd4 is still affected; this is a session-ticket-cache regression distinct from CVE-2021-22924's live connection-cache bug because the vulnerable cache was added later by fa0ccd9f, and I used AI to assist the audit and report while personally rerunning and checking every claim.

Impact

An application that reuses a multi handle or shared TLS session cache across per-transfer CA profiles can send credentials or request data to a server that the active CA profile explicitly does not trust.

The original report as published on HackerOne, by 1rhino2. 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 session-cache peer key is compared with a case-insensitive string function even though it contains case-sensitive file paths for CA, CRL and issuer data.

Impact

An application reusing a multi handle or shared TLS session cache across per-transfer CA profiles could send credentials or request data to a server the active CA profile explicitly does not trust.

What the attacker needed

Application reuses multi handle or session cache; per-transfer CA profiles differ only by path case; attacker controls a server untrusted by active profile

The fix

Using a case-sensitive comparison such as strcmp() instead of case-folding would avoid the reuse.

How it was found

  1. Start with a trusted CA file and connect, establishing a TLS session.
  2. Switch to an unrelated CA file whose path differs only in case.
  3. Observe that curl logs session reuse and sends the bearer token, receiving HTTP 200 responses.
  4. Repeat with an unrelated CA under a differently named file to see the safe control behaviour.

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.

When curl connects to a server over HTTPS, it can remember the secure session so a later connection is quicker. It decides whether to reuse that memory by comparing details about the connection, including the path to the file listing trusted certificates. Here it compared those paths while ignoring upper and lower case, so two different trust files with names like Trust.pem and trust.pem looked identical, and curl reused a session it should have treated as untrusted.

What is Crypto?

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.

More by 1rhino2

View all

12 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.

Cryptographic weaknesses

The lesson behind this report.

Encryption, signatures, randomness or certificate checks that do not protect what they claim to.