wolfSSL — Missing Timeout in Built-in OCSP and CRL Revocation Fetch
The built-in OCSP and CRL lookup callbacks connect to the URL named in the peer's certificate and read the HTTP response with no time limit. A responder that accepts the connection and then stops sending keeps the verifying thread blocked inside the handshake call indefinitely.
- Advisory
- BYTERAY-2026-0318
- CWE
- CWE-389
- CVSS
- 7.5 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H)
- Vendor
- wolfSSL
- Product
- wolfSSL
- Reported
- 2026-09-27
- Disclosure
- 2026-12-03
- Affected
- wolfSSL 5.9.2 (tested at master commit d95483f), builds with HAVE_OCSP, or with HAVE_CRL and HAVE_CRL_IO, that use the built-in HTTP lookup callbacks with revocation checking enabled
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
When revocation checking is enabled and the application has not installed its own lookup callback, wolfSSL fetches OCSP responses and CRLs itself. EmbedOcspLookup() and EmbedCrlLookup() in src/wolfio.c take a URL from the certificate being checked, open a TCP connection to the host in it, send an HTTP request and read the reply.
Neither phase has a time limit. The timeout handed to the connect is 0 by default in every build, so the connect is a plain blocking connect(). The response is read by loops that call a blocking recv() on a socket with no receive timeout. A responder that accepts the connection, sends part of a header and then goes quiet holds the loop there.
The fetch runs inside the handshake, on the thread that called wolfSSL_connect() or wolfSSL_accept(). That call does not return, so a timeout the application applies around its handshake cannot recover the thread. The party who chose the URL in the certificate also chooses how the responder behaves. OCSP and CRL checking are not part of a default build.
Affected Products and Versions
- Component:
src/wolfio.c,EmbedOcspLookup()andEmbedCrlLookup(), the default OCSP and CRL I/O callbacks, and the HTTP client helpers they call. - Required build:
HAVE_OCSPfor the OCSP path;HAVE_CRLandHAVE_CRL_IOfor the CRL path. Revocation checking must be enabled at run time and the built-in callbacks must be in use. - Present with and without
HAVE_IO_TIMEOUT. The timeout value defaults to 0 in both cases (src/wolfio.c:1323-1331). - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
- A default
./configurebuild does not enable OCSP or CRL checking and is not affected. - Other releases were not checked.
Technical Details
The timeout used by both callbacks is defined once for the HTTP client (src/wolfio.c:1323-1331):
#ifndef HAVE_IO_TIMEOUT
#define io_timeout_sec 0
#else
#ifndef DEFAULT_TIMEOUT_SEC
#define DEFAULT_TIMEOUT_SEC 0 /* no timeout */
#endif
static int io_timeout_sec = DEFAULT_TIMEOUT_SEC;
EmbedOcspLookup() passes it to the connect (src/wolfio.c:2530-2531), and EmbedCrlLookup() does the same (src/wolfio.c:2633-2634):
else if ((ret = wolfIO_TcpConnect(&sfd, domainName, port,
io_timeout_sec)) != 0) {
WOLFSSL_MSG("OCSP Responder connection failed");
}
wolfIO_TcpConnect() switches the socket to non-blocking mode and waits with select() only when to_sec > 0 (src/wolfio.c:1559). With 0 it calls connect() directly (src/wolfio.c:1566). The response is then read through httpResponseIoCb(), which calls wolfIO_Recv() with no flags (src/wolfio.c:2079), and wolfIO_Recv() is a single recv() call (src/wolfio.c:1256-1266). No receive timeout is set on the fetch socket.
How a certificate reaches this code:
- The peer presents a certificate. The parser stores its OCSP URI from the Authority Information Access extension (
wolfcrypt/src/asn.c:21255) and its CRL distribution point. - During verification,
ProcessPeerCerts()(src/internal.c:18200) reaches the revocation checks. The OCSP check selects the certificate's URL when no override is configured (src/ocsp.c:537-539). The CRL check hands the distribution point to the I/O callback when no CRL for the issuer is loaded (src/crl.c:622-627). - The callbacks are
EmbedOcspLookup()(src/ssl_certman.c:2290) andEmbedCrlLookup()(src/ssl_certman.c:1820) unless the application replaced them. - The callback parses the URL and calls
wolfIO_TcpConnect()with the 0 timeout (src/wolfio.c:2530,src/wolfio.c:2633). to_sec > 0is false, so the connect blocks until the kernel gives up or the peer answers (src/wolfio.c:1559-1566).- After the request is sent, the header and body loops in
wolfIO_HttpProcessResponseGenericIO()(src/wolfio.c:1898) callrecv()until the response is complete. A responder that stops sending leaves the thread inrecv().
Reachability and Preconditions
- Build with
HAVE_OCSP, or withHAVE_CRLandHAVE_CRL_IO, and revocation checking enabled at run time (for examplewolfSSL_CTX_EnableOCSPorwolfSSL_CTX_EnableCRL). - The built-in lookup callbacks are in use. An application that registered its own OCSP or CRL I/O callback does not run this code.
- The attacker is a TLS peer, client or server, who presents a certificate with an OCSP or CRL URL of their choosing and controls the host that URL names.
- The lookup happens during the handshake, before it completes. The leaf revocation check runs only when certificate processing has reported no earlier error (
src/internal.c:19258-19259), so the certificate has to be one the verifier accepts up to that point, or the verifier does not verify the chain. BYTERAY-2026-0363 and BYTERAY-2026-0364 describe the same condition for these callbacks. - For the CRL path, the fetch happens only when no current CRL for the issuer is already loaded.
Impact
Each handshake that triggers a lookup against a stalling responder ties up one thread inside a wolfSSL call that does not return. On a server or gateway with a fixed number of workers, repeated connections exhaust the workers, and with them file descriptors and memory. Confidentiality and integrity are not affected.
ByteRay reproduced this with a TLS client that had OCSP checking enabled for all certificates and a server certificate naming a responder that accepted the connection and then stalled. The client thread stayed blocked in the recv() of the OCSP fetch inside wolfSSL_connect() and came back only when a signal interrupted the call.
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 a bounded, configurable timeout on both phases. The callbacks should pass a non-zero default to wolfIO_TcpConnect() so its existing select() path runs, and the read side should set a receive timeout on the fetch socket or wait with select() before each read. An overall deadline per lookup, covering the header and body loops, should make the callback return an error so that verification is aborted.
Until then, applications can replace the default callbacks with their own non-blocking ones that enforce a timeout (wolfSSL_CTX_SetOCSP_Cb, wolfSSL_SetCRL_IOCb), or restrict fetching to responder URLs configured by the operator. Loading CRLs out of band avoids the CRL fetch.
Timeline
- 2026-09-27 — Reported to wolfSSL.
- 2026-12-03 — Public disclosure.
Credits
Discovered and reported by Mehrun P. Hunter and Shahriyar Jalayeri of ByteRay Ltd.
References
EmbedOcspLookupconnect and response read at the tested commitEmbedCrlLookupconnect and response read at the tested commit- HTTP client timeout default at the tested commit
- Blocking connect in
wolfIO_TcpConnectat the tested commit - BYTERAY-2026-0363, missing destination validation for CRL distribution point fetches
- BYTERAY-2026-0364, DNS rebinding window in the OCSP responder screen