Skip to content
Crypto Disclosed report Advanced CVE-2026-8286CVE-2022-27782

CVE-2026-8286: wrong STARTTLS connection reuse

Connection reuse matching in curl skips the TLS configuration comparison for plain schemes that were upgraded with STARTTLS, so a connection opened with certificate verification disabled can be reused by a handle that requires verification and key pinning. An on-path attacker who intercepts the STARTTLS upgrade could therefore have a later, stricter handle accept the unverified session.

Daniel Stenberg Follow

Originally disclosed on HackerOne

  • Triaged in 9 hours
  • Fixed in 48 days
  • Disclosed after 48 days

Finding F3 from Andrew Nesbit's report:

https://github.com/curl/curl/blob/455bebc2c7/lib/url.c#L1024-L1036 https://github.com/curl/curl/blob/455bebc2c7/lib/url.c#L825-L844

url_match_ssl_config() is gated on m->needle->scheme->flags & PROTOPT_SSL. For imap://, pop3://, smtp://, ftp://, ldap:// with CURLOPT_USE_SSL (STARTTLS), the scheme lacks PROTOPT_SSL, so Curl_ssl_conn_config_match is never called even though the connection runs TLS. url_match_ssl_use() at L833-838 lets a plain-scheme needle reuse an SSL-upgraded conn via PROTOPT_SSL_REUSE without ever reaching the config comparison; the req_tls check at L840 only fires when the existing conn is NOT ssl.

Impact

Impact: handle A connects imap://host with CURLOPT_USE_SSL=CURLUSESSL_ALL and CURLOPT_SSL_VERIFYPEER=0; on-path attacker MITMs the STARTTLS upgrade. Handle B connects imap://host with USE_SSL=ALL, VERIFYPEER=1, and a pinned key. B reuses A's unverified TLS session; B's verifypeer/pinning never run. (FTP's ftp_conns_match checks use_ssl level and ftp_ccc but not ssl_primary_config; IMAP/POP3/SMTP have no protocol-specific check at all.)

Same bug class as CVE-2022-27782 (TLS/SSH too-eager reuse) - that fix added Curl_ssl_conn_config_match but only behind a PROTOPT_SSL gate, missing the STARTTLS path. Verified by reading both functions and tracing the needle for imap:// + USE_SSL through url_match_ssl_use → returns TRUE at L838, then url_match_ssl_config → returns TRUE at L1028 without calling Curl_ssl_conn_config_match.

The original report as published on HackerOne, by bagder. 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 reuse matcher only compares TLS settings when the URL scheme itself is flagged as SSL, so schemes that reach TLS through STARTTLS never trigger the comparison.

Impact

An on-path attacker who intercepts the STARTTLS upgrade could get a handle that requires verification and pinning to silently reuse the unverified session, though this depends on another handle in the same process having disabled verification.

What the attacker needed

Two handles in one process; first handle disables peer verification; on-path attacker

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 a program opens several connections to the same server, it may reuse an existing one to save time. Here the check that decides whether reuse is safe ignored the security settings for mail and file protocols that start plain and then upgrade to encryption. That let a connection set up with no certificate checking be handed to a part of the program that had asked for strict checking.

What is Crypto?

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

More by Daniel Stenberg

View all

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