wolfSSL — DNS Rebinding Window Between the OCSP Responder Screen and the Connect
The opt-in OCSP responder screen resolves the responder host name, checks the addresses and discards them. The connect that follows resolves the name again and uses the first answer. A name whose DNS answers change between the two lookups passes the screen and receives the OCSP request at a loopback, link-local or private address.
- Advisory
- BYTERAY-2026-0364
- CWE
- CWE-180
- CVSS
- 4.8 (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N)
- Vendor
- wolfSSL
- Product
- wolfSSL
- Reported
- 2026-09-28
- Disclosure
- 2026-12-03
- Affected
- wolfSSL 5.9.4, builds with HAVE_OCSP and WOLFSSL_OCSP_SCREEN_RESPONDER using the default OCSP lookup callback
- Credit
- Mehrun P. Hunter and Shahriyar Jalayeri, ByteRay Ltd.
Executive Summary
When wolfSSL fetches an OCSP response itself, the URL normally comes from the Authority Information Access extension of the certificate being checked. Builds that define WOLFSSL_OCSP_SCREEN_RESPONDER add a screen: the host is resolved, and the lookup is refused if any address is loopback, link-local, private or otherwise reserved.
The screen returns only yes or no. It does not hand the addresses it checked to the caller. The caller then connects by host name, and the connect routine performs its own DNS lookup. The two lookups are independent. Whoever answers DNS for the host can give a public address to the first and an internal address to the second.
The result is that the verifier sends an HTTP OCSP request to an address the screen was built to exclude. The response is only parsed as OCSP, so the request is blind. The source comment above the screen states that it does not defeat DNS rebinding and calls it best effort. Builds without the macro have no screen at all, so there is nothing to bypass there.
Affected Products and Versions
- Component:
src/wolfio.c,wolfIO_OcspDestAllowed()and its callerEmbedOcspLookup(), withwolfIO_TcpConnect(). - Required build:
HAVE_OCSPandWOLFSSL_OCSP_SCREEN_RESPONDER. The second is a macro the integrator defines; no configure option sets it. The default I/O layer must be in use (WOLFSSL_USER_IOnot defined). - Tested: wolfSSL master d95483fff72d6e987394b72edca433d4b580a0f4 (version string 5.9.2).
v5.9.2-stabledoes not contain the responder screen and is not affected.v5.9.4-stablecontains the screen and the same flow. Not fixed on master.- A default
./configurebuild does not compile the screen. Earlier releases were not checked.
Technical Details
The call site in EmbedOcspLookup(), src/wolfio.c:2506-2513:
#ifdef WOLFSSL_OCSP_SCREEN_RESPONDER
/* Opt-in: reject responders that resolve to private/loopback/link-local
* ranges to keep a certificate-supplied AIA URL from forcing an internal
* request (SSRF, CWE-918). */
else if (!wolfIO_OcspDestAllowed(domainName)) {
WOLFSSL_MSG("OCSP responder destination not permitted");
}
#endif
Inside the screen the answers live only for the duration of the call: getaddrinfo() at src/wolfio.c:2387, a loop that checks each address, and freeaddrinfo(answer) at src/wolfio.c:2406.
wolfIO_DecodeUrl()splits the URL intodomainName,pathandport(src/wolfio.c:2503).wolfIO_OcspDestAllowed(domainName)resolves the name (first lookup), checks every address and returns 1 (src/wolfio.c:2392-2406,src/wolfio.c:2460).EmbedOcspLookup()builds the request and callswolfIO_TcpConnect(&sfd, domainName, port, ...)(src/wolfio.c:2530).wolfIO_TcpConnect()callsgetaddrinfo()again (second lookup,src/wolfio.c:1495) and copies the first answer into the socket address (src/wolfio.c:1500-1501). That address is not checked.- The OCSP request is sent to it.
The gethostbyname fallback has the same shape: one lookup in the screen (src/wolfio.c:2432-2436) and another in the connect (src/wolfio.c:1513-1516). The limitation is written down in the comment at src/wolfio.c:2354-2358: the connect resolves the name again, the screen does not by itself defeat a DNS-rebinding responder, and deployments that need a hard guarantee should install their own OCSP I/O callback.
Reachability and Preconditions
- Build with the screen compiled in, OCSP checking enabled at run time, and the default lookup callback (
src/ssl_certman.c:2288-2292). No OCSP override URL is set; with an override, the configured URL is used instead of the certificate's (src/ocsp.c:530-539). - The lookup runs only for a certificate that has already passed chain verification (
src/internal.c:19258-19259; chain certificates atsrc/internal.c:18667-18671). The attacker needs a certificate the verifier accepts whose OCSP URL names a host under the attacker's DNS control. In practice that means a CA in the verifier's trust store that will issue a certificate with an AIA host of the requester's choosing, a CA the attacker operates, or a verifier that does not verify the chain (src/internal.c:18989-18991). - The attacker presents that certificate as a TLS peer and serves DNS for the host with short-lived, alternating answers. The switch has to land between the two lookups, so several attempts can be needed.
Impact
Confirmed from source: on a build that enables the screen, an OCSP request can be sent to an address in a range the screen rejects, including loopback, 169.254.0.0/16 and the private IPv4 ranges. The request is an HTTP POST to a path and port taken from the URL, with an OCSP request as its body. The attacker does not see the response. wolfSSL parses it as an OCSP response and discards it otherwise. What the request does to the internal service depends on that service and was not assessed.
The screen is documented in the source as best effort, and its comment names this gap. Deployments that enabled the macro expecting a firm barrier do not get one.
ByteRay did not build a proof of concept for this issue. The analysis is from source review.
Remediation and Mitigation
Not fixed on wolfSSL master as of commit e4b0841b32e7 (2026-12-03).
The fix direction is to resolve once: have the screen return the address it approved and connect to that address, or apply the range check to the address the connect is about to use. Either removes the second lookup from the decision.
Workaround: install an application OCSP I/O callback with wolfSSL_CTX_SetOCSP_Cb that resolves once and connects to the checked address, or configure an override responder URL so that the certificate's URL is not used. Both give up the built-in fetch of certificate-named responders.
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.