wolfSSL — Leaf Certificate Revocation Checks Skipped for OCSP Stapling Clients
When the server answers a client's OCSP stapling request, wolfSSL turns off its own OCSP and CRL lookups for the leaf certificate and relies on the staple. A missing or zero-length staple is then accepted unless must-staple is set, so a server can complete the handshake with a leaf certificate that had no revocation check.
- Advisory
- BYTERAY-2026-0369
- 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), clients built with HAVE_CRL, HAVE_OCSP and OCSP stapling that enable CRL and OCSP checking, request stapling and do not set must-staple
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
ProcessPeerCertLeafRevocation() runs the revocation checks for the server's leaf certificate: an OCSP lookup, then a CRL check. When the connection has a stapling extension in play, the function turns both checks off. The reasoning is that the stapled OCSP response will be verified instead.
That replacement check does not enforce anything by default. A staple that is missing or has length zero is treated as success unless the application enabled must-staple. The must-staple fallback inside this function sits in an else branch that runs only when no stapling extension was seen at all, so a server that sends the extension with an empty response avoids it.
The server decides whether it sends the extension and whether it attaches a real response. A server holding a leaf certificate that the CRL lists as revoked can send an empty stapling commitment and the client completes the handshake. The configuration involved, CRL and OCSP checking together with stapling, is not a default build.
Affected Products and Versions
- Component:
src/internal.c,ProcessPeerCertLeafRevocation(), called fromProcessPeerCerts(). - Required build:
HAVE_CRLandHAVE_OCSPwithHAVE_CERTIFICATE_STATUS_REQUESTorHAVE_CERTIFICATE_STATUS_REQUEST_V2. - Required configuration: CRL checking and OCSP checking enabled on the client, stapling requested, must-staple not set.
- Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default build is not affected. CRL support is disabled by default (
configure.ac:9145), and must-staple is unset by default. - Other releases were not checked.
Technical Details
For a stapling connection the function clears its lookup flag. Inside if (ssl->status_request) it initialises the stapling request and sets doLookup = 0 (src/internal.c:17520-17524). The status_request_v2 branch does the same (src/internal.c:17546-17551). Both leaf checks depend on that flag: the OCSP check at src/internal.c:17557 and the CRL check at src/internal.c:17588-17590. With doLookup at zero neither runs.
What is left is the staple check, and it accepts an absent staple:
TLSX_CSR_Parse()setsssl->status_request = 1for anystatus_requestextension from the server (src/tls.c:3833) and stores the response even when its length is zero (src/tls.c:3844-3874).ProcessPeerCertLeafRevocation()sees the flag and setsdoLookup = 0.- On TLS 1.3 it calls
ProcessPeerCertsChainOCSPStatusCheck()(src/internal.c:17528). For a leaf with no response, or a response of length zero, that function returns 0 unlessocspMustStapleis set (src/internal.c:17215-17219). - The must-staple fallback at
src/internal.c:17538-17543is theelseof thessl->status_requesttest. It does not run once the server has sent the extension. - The leaf OCSP and CRL blocks are skipped, and
ProcessPeerCerts()reaches its success path (src/internal.c:19358).
Chain certificates do not close the gap. For a stapling client, chain CRL failures other than an explicit revocation are overridden separately (src/internal.c:18749-18754, BYTERAY-2026-0370). The leaf path differs in that its checks are not run at all, so a CRL that lists the leaf as revoked is never consulted.
If the server sends no stapling extension, ssl->status_request stays zero and the leaf checks run as configured. The extension is what triggers the skip.
Reachability and Preconditions
- Build with CRL, OCSP and OCSP stapling support.
- The client enables CRL and OCSP checking and requests stapling.
ocspMustStapleis not set. - The attacker is the TLS server, or an on-path party in a TLS 1.2 static-RSA deployment. The direct trigger is a
status_requestextension in a TLS 1.3 Certificate entry that carries a zero-length response. - The presented chain passes signature, trust and validity checks. Only its revocation state is wrong.
- The attacker does not need to interfere with the client's CRL or OCSP fetches. Withholding the staple is enough.
- No authentication is required.
Impact
A client that enables leaf revocation checking and stapling accepts a server certificate with no revocation status established. This includes a certificate that the loaded or fetchable CRL lists as revoked, because the CRL check for the leaf does not run. An attacker who holds the private key of a revoked certificate can use it against such a client.
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 make the delegated check fail closed. When the client requested stapling and no usable response arrives for the leaf, the handshake should fail, or the function should fall back to the OCSP and CRL lookups it skipped. The leaf CRL check should not depend on the stapling flag when the application asked for CRL checking. The must-staple test should apply whenever stapling was requested and no usable response was received, not only when the extension was absent. TLSX_CSR_Parse() should reject a zero-length response.
Workaround: set must-staple on the client (wolfSSL_CTX_EnableOCSPMustStaple). The handshake then fails when the leaf staple is missing or empty.
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.