Skip to content
Crypto Disclosed report Advanced CVE-2024-8096CVE-2024-0853CVE-2026-7009

CVE-2026-7009: OCSP stapling bypass with Apple SecTrust

When curl is built with Apple SecTrust and OpenSSL, --cert-status is silently bypassed because SecTrust verification skips the OCSP stapling check, so the connection succeeds without a staple.

3lcarry Follow

Originally disclosed on HackerOne

  • Disclosed after 4 days

Summary

When curl is built with --with-apple-sectrust (or -DUSE_APPLE_SECTRUST=ON) and OpenSSL, the --cert-status / CURLOPT_SSL_VERIFYSTATUS option is silently bypassed when Apple SecTrust handles certificate chain verification instead of OpenSSL.

The user explicitly requests OCSP stapling enforcement, but the connection succeeds even when the server provides no OCSP staple — violating the documented guarantee that curl "aborts the connection" when no OCSP response is received.

Root Cause

In lib/vtls/openssl.c, Curl_ossl_check_peer_cert(), commit b4630ed8fa (2025-10-31, fixing #19307) introduced a sectrust_verified flag that skips OpenSSL's verifystatus() call when Apple SecTrust verified the certificate chain:

C
#ifdef USE_APPLE_SECTRUST
  if(!verified && conn_config->verifypeer && ssl_config->native_ca_store) {
    result = ossl_apple_verify(cf, data, octx, peer, &verified);
    if(verified) {
      sectrust_verified = TRUE;
    }
  }
#endif
  ...
  if(conn_config->verifystatus &&
#ifdef USE_APPLE_SECTRUST
     !sectrust_verified &&  /* <-- skips the OCSP check */
#endif
     !octx->reused_session) {
    result = verifystatus(cf, data, octx);  /* never reached */
  }

The assumption is "SecTrust already handled OCSP." But SecTrust only receives a stapled OCSP response when ocsp_len > 0 (in ossl_apple_verify). If the server doesn't staple, SSL_get_tlsext_status_ocsp_resp() returns -1, which is clamped to 0, and SecTrustSetOCSPResponse() is never called. SecTrust's default revocation policy (kSecRevocationUseAnyAvailableMethod) is best-effort — kSecRevocationRequirePositiveResponse is explicitly #if 0 in apple.c.

Result: no OCSP enforcement happens at all.

Affected Versions

Introduced in commit b4630ed8fa (2025-10-31). Present in curl 8.17.0, 8.18.0, 8.19.0, and current master.

Steps To Reproduce

Step 1: Build two versions of curl

Tested on curl master at commit bfcc1c6eb4. The bug was introduced in commit b4630ed8fa (2025-10-31), so any version >= 8.17.0 is affected.

Build A — OpenSSL only (control):

cmake -DCURL_USE_OPENSSL=ON -DUSE_APPLE_SECTRUST=OFF
curl --version
curl 8.20.0-DEV (Darwin) libcurl/8.20.0-DEV OpenSSL/3.6.1 zlib/1.2.12 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 nghttp2/1.68.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt mqtts pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss
Features: alt-svc AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz NTLM PSL SSL threadsafe TLS-SRP UnixSockets zstd

Build B — OpenSSL + Apple SecTrust (test):

cmake -DCURL_USE_OPENSSL=ON -DUSE_APPLE_SECTRUST=ON
curl --version
curl 8.20.0-DEV (Darwin) libcurl/8.20.0-DEV OpenSSL/3.6.1 zlib/1.2.12 brotli/1.2.0 zstd/1.5.7 libidn2/2.3.8 libpsl/0.21.5 nghttp2/1.68.0
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt mqtts pop3 pop3s rtsp smtp smtps telnet tftp ws wss
Features: alt-svc AppleSecTrust AsynchDNS brotli HSTS HTTP2 HTTPS-proxy IDN IPv6 Largefile libz PSL SSL threadsafe TLS-SRP UnixSockets zstd

Note AppleSecTrust in the Features line of Build B.

Step 2: Generate test certificates

Bash
# Generate CA
openssl req -x509 -newkey rsa:2048 -days 30 -nodes \
  -keyout ca-key.pem -out ca.pem -subj "/CN=PoC Test CA"

# Generate server cert signed by CA (SAN=localhost)
openssl req -newkey rsa:2048 -nodes \
  -keyout server-key.pem -out server.csr -subj "/CN=localhost"
openssl x509 -req -days 30 -in server.csr \
  -CA ca.pem -CAkey ca-key.pem -CAcreateserial \
  -out server.pem -extfile <(printf "subjectAltName=DNS:localhost")

Step 3: Add CA to macOS Keychain

Add the CA to the macOS login keychain as trusted:

Bash
security add-trusted-cert -r trustRoot -k ~/Library/Keychains/login.keychain-db ca.pem

Step 4: Start test server (no OCSP stapling)

openssl s_server does not staple OCSP by default:

Bash
openssl s_server -cert server.pem -key server-key.pem -accept 4433 -www

Step 5: Run the three tests

Test 1 — Control (Build A, OpenSSL only):

Bash
curl -v --cert-status --cacert ca.pem https://localhost:4433/

Test 2 — Bug (Build B, SecTrust):

Bash
curl -v --cert-status --ca-native https://localhost:4433/

Test 3 — Sanity (Build B, SecTrust, no --cert-status):

Bash
curl -v --ca-native https://localhost:4433/

Clean up when done:

Bash
security delete-certificate -c "PoC Test CA" ~/Library/Keychains/login.keychain-db

Results

Test Build Flags Result Expected
1 OpenSSL only --cert-status --cacert ca.pem FAIL (exit 91): "No OCSP response received" Correct — OCSP enforced
2 OpenSSL + SecTrust --cert-status --ca-native SUCCESS (exit 0) WRONG — OCSP bypassed
3 OpenSSL + SecTrust --ca-native SUCCESS (exit 0) Correct — no OCSP requested

Test 1 verbose output (relevant lines):

* OpenSSL verify result: 0
* SSL certificate verified via OpenSSL.
* No OCSP response received
* closing connection #0
curl: (91) No OCSP response received

Test 2 verbose output (relevant lines):

* OpenSSL verify result: 14
* SSL certificate verified via Apple SecTrust.
* Established connection to localhost (::1 port 4433) from ::1 port 49751

No OCSP check occurs. The connection succeeds despite --cert-status being set and the server providing no OCSP staple.

Impact

Summary:

A user who sets --cert-status / CURLOPT_SSL_VERIFYSTATUS expects curl to abort the connection if the server does not provide a valid OCSP stapled response. This is documented behavior: "If this option is enabled and the server sends an invalid response, or no response at all is received, the verification fails."

When Apple SecTrust handles verification (build with USE_APPLE_SECTRUST, runtime with --ca-native), this guarantee is silently violated. The OCSP stapling check is skipped entirely, and the connection proceeds as if --cert-status was never set.

This is the same vulnerability class as CVE-2024-8096 (OCSP stapling bypass with GnuTLS) and CVE-2024-0853 (OCSP verification bypass with TLS session reuse).

The original report as published on HackerOne, by 3lcarry. 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

A flag introduced to skip OpenSSL's OCSP check when Apple SecTrust verified the chain assumed SecTrust enforces OCSP, but SecTrust only receives a stapled response when one is present and its default policy is best-effort, so no OCSP enforcement occurs.

Impact

A user who sets --cert-status expects curl to abort when no valid OCSP staple is received, but with Apple SecTrust the check is skipped and the connection proceeds.

What the attacker needed

Curl built with Apple SecTrust and OpenSSL; runtime use of --ca-native; server does not staple OCSP

How it was found

  1. Build curl with OpenSSL only as a control, and build curl with OpenSSL plus Apple SecTrust as the test version.
  2. Generate a test CA and a server certificate signed by it for localhost.
  3. Add the test CA to the macOS login keychain as trusted.
  4. Start an OpenSSL test server that does not staple OCSP.
  5. Run curl with --cert-status against the test server using both builds and compare the results.

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.

OCSP stapling lets a site prove its certificate is not revoked. curl can require this proof and refuse the connection if it is missing. Here, when curl uses Apple's certificate checking instead of OpenSSL's, that requirement is quietly ignored.

What is Crypto?

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

More by 3lcarry

View all

1 more disclosed report, 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.