← ALL ADVISORIES

MEDIUM BYTERAY-2026-0368Disclosed

wolfSSL — Missing Stapled OCSP Enforcement for Chain CAs in TLS 1.2 CertificateStatus Handling

A TLS 1.2 client that requests ocsp_multi stapling defers revocation checking of chain CA certificates to the CertificateStatus message. The handler for that message requires a stapled response for the leaf only, then adds every pending chain CA to the certificate manager whether or not a response for it arrived.

Advisory
BYTERAY-2026-0368
CWE
CWE-370
Vendor
wolfSSL
Product
wolfSSL
Reported
2026-09-28
Disclosure
2026-12-03
Affected
wolfSSL 5.9.2 (tested at master commit d95483f), TLS 1.2 clients built with HAVE_CRL, HAVE_OCSP and HAVE_CERTIFICATE_STATUS_REQUEST_V2 that check revocation for the whole chain and request OCSP stapling v2 (ocsp_multi)
Credit
Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.

Executive Summary

A wolfSSL client can ask a TLS 1.2 server for stapled OCSP responses covering the whole chain (status_request_v2, ocsp_multi). When it does, the chain CA certificates from the Certificate message are held in a pending-CA pool. Their revocation status is meant to be settled by the staples in the CertificateStatus message that follows.

DoCertificateStatus() does not settle it. The handler requires a valid response for the first entry only, the leaf. An entry for a chain CA can be absent or have length zero, and the handler skips it without error. It then promotes every pooled chain CA into the certificate manager. If that promotion fails, the failure is logged and the handshake continues.

A server that sends a good leaf staple and withholds the chain staples completes the handshake with no revocation status for the chain CAs. The gap shows when revocation data for a chain CA is unobtainable or stale; a chain certificate that a fetched CRL lists as revoked is still rejected. The configuration is not a default build.

Affected Products and Versions

  • Component: src/internal.c, DoCertificateStatus(), TLS 1.2 client side, ocsp_multi branch.
  • Required build: HAVE_CRL, HAVE_OCSP and HAVE_CERTIFICATE_STATUS_REQUEST_V2. Required configuration: CRL checking for all certificates (WOLFSSL_CRL_CHECKALL), OCSP checking for all certificates (WOLFSSL_OCSP_CHECKALL), and stapling v2 requested by the client.
  • Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
  • A default build is not affected. CRL support and OCSP stapling v2 are both disabled by default (configure.ac:9109, configure.ac:9145).
  • Other releases were not checked.

Technical Details

The ocsp_multi loop in DoCertificateStatus() starts at src/internal.c:19739. It reads one length-prefixed response per iteration. Three properties of the loop matter:

  • A response of length zero is skipped. The body that decodes and checks a response is inside if (status_length) (src/internal.c:19754), and there is no else.
  • Only the first response is mandatory. endCertificateOK is set when ret == 0 && idx == 0 (src/internal.c:19788-19789), and it is the only condition tested after the loop (src/internal.c:19817-19819).
  • The index cap at src/internal.c:19794-19798 bounds the number of entries. It does not match responses to the chain CAs that are waiting in the pool.

After the loop, when ret is 0, the handler calls TLSX_CSR2_MergePendingCA() and only logs "Failed to merge pending CAs" if it returns an error (src/internal.c:19821-19825). That function walks the pending list and calls AddSigner() for each entry (src/tls.c:4478-4498). It has no notion of whether a response was received for that signer.

How a chain CA reaches the pool without a revocation result:

  1. The client requests ocsp_multi. While ProcessPeerCerts() handles each chain certificate it marks the certificate as waiting for a staple (src/internal.c:18645).
  2. The chain CRL check runs (src/internal.c:18718). Any failure other than CRL_CERT_REVOKED is replaced with success because a staple is expected later (src/internal.c:18749-18754). This step is BYTERAY-2026-0370.
  3. The chain CA is added to the pending pool (src/internal.c:18875-18895).
  4. The server sends CertificateStatus with one good response for the leaf and nothing, or zero-length entries, for the chain.
  5. DoCertificateStatus() sets endCertificateOK, skips the rest and merges the pool. The handshake completes.

The same merge exists a second time in the ServerHelloDone path, used when no CertificateStatus message was received (src/internal.c:20362-20366). Only one of the two runs in a given handshake.

Reachability and Preconditions

  • Build with HAVE_CRL, HAVE_OCSP and HAVE_CERTIFICATE_STATUS_REQUEST_V2.
  • The client enables CRL and OCSP checking for the whole chain and requests ocsp_multi stapling. TLS 1.2 only.
  • The attacker is the TLS server the client connects to, or an on-path party in a TLS 1.2 static-key cipher suite deployment.
  • The presented chain passes signature, name and validity checks.
  • The CRL for the chain CA is missing or stale from the client's point of view, for example because the attacker blocks the client's CRL fetch. A fetched CRL that lists the certificate is still honoured.
  • No authentication is required. The messages involved are part of the server's handshake flight.

Impact

A client configured for full-chain revocation checking with stapling accepts a chain whose CA certificates had no revocation check at all. A chain under an intermediate that has been revoked is accepted when the client cannot obtain current revocation data and the server omits the chain staples. The result is a session with a peer the configured policy was meant to reject.

ByteRay did not build a proof of concept for this issue. The analysis is from source review.

Remediation and Mitigation

ByteRay has not confirmed a fixed wolfSSL release for this issue as of 2026-12-03, and has not checked it against wolfSSL changes made after the tested commit.

The fix direction is to account for staples per pending CA. The ocsp_multi loop should record which pool entries received a valid response, treat an absent or zero-length entry for a pending CA as missing revocation data, and fail with BAD_CERTIFICATE_STATUS_ERROR instead of merging when any pending CA is uncovered. An error from TLSX_CSR2_MergePendingCA() should be returned, not logged. The same rule is needed at the second merge site in the ServerHelloDone path. As a workaround, load current CRLs for the chain CAs out of band so the chain CRL check has data to work with, or do not combine ocsp_multi stapling with a policy that depends on chain revocation.

Timeline

  • 2026-09-28 — Reported to wolfSSL.
  • 2026-12-03 — Public disclosure.

Credits

Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.

References