CVE-2026-80231: native CA store conn reuse
On macOS, curl's connection-reuse matching ignored the native_ca_store flag, so a transfer meant to use SecTrust could reuse an OpenSSL-only verified connection, letting a certificate trusted under one policy but not the other pass without re-checking.
Originally disclosed on HackerOne
- Triaged in 2 hours
- Fixed in 8 days
- Disclosed after 8 days
Summary
native_ca_store is in struct ssl_config_data (line 73 of vtls_config.h), not ssl_primary_config. match_ssl_primary_config() does not compare it. On macOS, Curl_ssl_easy_config_complete() (line 258) auto-sets native_ca_store = TRUE when no custom CA is configured — without modifying ssl_options. When CURL_CA_BUNDLE is defined, the auto-fill gives both transfers the same primary.CAfile, making all primary config fields match while native_ca_store differs.
Transfer A (explicit CURLOPT_CAINFO = CURL_CA_BUNDLE path): custom_cafile=TRUE, auto-setting prevented, native_ca_store=FALSE — OpenSSL-only verification.
Transfer B (no CURLOPT_CAINFO): auto-fill sets same CAfile, custom_cafile=FALSE, auto native_ca_store=TRUE — intended SecTrust verification.
match_ssl_primary_config sees matching CAfile + ssl_options → connection reused. B inherits A's connection without SecTrust ever running.
Reproduction
macOS baremetal (poc-native-ca.c), built with -DUSE_APPLE_SECTRUST=ON -DCURL_CA_BUNDLE=<path> -DCURL_USE_OPENSSL=ON:
- Transfer A: explicit
CURLOPT_CAINFO=CURL_CA_BUNDLEpath → OpenSSL verifies - Transfer B: no
CAINFO→ auto-fill, autonative_ca_store=TRUE→ should use SecTrust - Observe:
"Reusing existing https: connection"— SecTrust never runs
Root cause trace
Curl_ssl_easy_config_complete()(line 258):!custom_capath && !custom_cafile && !custom_cablob→native_ca_store = TRUE. Does NOT modifyssl_options.CURL_CA_BUNDLEauto-fill (line 269): setsSTRING_SSL_CAFILE→primary.CAfile= bundle path.- Transfer A explicitly sets
CURLOPT_CAINFOto the same path →custom_cafile=TRUE, auto-setting prevented,native_ca_store=FALSE. Sameprimary.CAfile, samessl_options=0. match_ssl_primary_configmatches all fields → connection reused.native_ca_storenot compared.
Remediation
Move native_ca_store into ssl_primary_config so match_ssl_primary_config() compares it. Or add an explicit check in Curl_ssl_conn_config_match().
Impact
A transfer expecting SecTrust verification silently inherits an OpenSSL-only verified connection (or vice versa). Certificates trusted by one policy but not the other pass without re-verification.
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
The native_ca_store field lives outside ssl_primary_config, so match_ssl_primary_config() never compares it when deciding whether a connection can be reused.
Impact
A transfer expecting SecTrust verification could silently inherit an OpenSSL-only verified connection, so certificates trusted by one policy but not the other pass without re-verification.
What the attacker needed
MacOS build with SecTrust and OpenSSL; CURL_CA_BUNDLE defined at build time; two transfers to the same host
The fix
The text proposes moving native_ca_store into ssl_primary_config so the match function compares it, or adding an explicit check in Curl_ssl_conn_config_match().
How it was found
- Build curl on macOS with SecTrust and OpenSSL enabled and a CA bundle path defined.
- Make transfer A with an explicit CAINFO option pointing at the CA bundle path, so OpenSSL verifies.
- Make transfer B without CAINFO, so the native CA store is auto-enabled and SecTrust should verify.
- Observe that the connection is reused and SecTrust never runs.
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 makes several requests to the same server, it reuses the existing connection to save time. Before reusing, it checks that the security settings of the two requests match. Here one setting (whether to use the operating system's certificate check on macOS) was left out of that comparison, so a request expecting the stricter check silently got a connection checked a different way.
What is Crypto?
Encryption, signatures, randomness or certificate checks that do not protect what they claim to.