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

Incomplete fix for CVE-2026-21637: loadSNI() in _tls_wrap.js lacks try/catch leading to Remote DoS

The TLS SNI callback in Node.js was invoked without a try/catch, so a synchronous exception thrown by an SNICallback escaped the TLS error handling and became an uncaught exception. An attacker could crash the Node.js process by sending a TLS handshake with an unexpected servername that makes the callback throw.

mbarbs Follow

Originally disclosed on HackerOne

High 7.5 View original
  • Disclosed after 2 months

Summary by the program

A flaw in Node.js TLS error handling leaves SNICallback invocations unprotected against synchronous exceptions, while the equivalent ALPN and PSK callbacks were already addressed in CVE-2026-21637. This represents an incomplete fix of that prior vulnerability.

When an SNICallback throws synchronously on unexpected input the exception bypasses TLS error handlers and propagates as an uncaught exception, crashing the Node.js process.

  • This vulnerability affects all Node.js versions that received the CVE-2026-21637 fix, including 20.x, 22.x, 24.x, and 25.x, on any TLS server where SNICallback may throw on unexpected servername input.

The original report as published on HackerOne, by mbarbs. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 4 min read.

What the report shows

The target is the Node.js runtime itself, specifically its TLS server implementation. The report describes an incomplete fix for an earlier vulnerability, CVE-2026-21637. That earlier issue concerned callbacks invoked during a TLS handshake: the ALPN and PSK callbacks were made to tolerate synchronous exceptions, but the SNICallback path was left unprotected.

The feature involved is Server Name Indication. When a TLS client connects, it can send a servername in the handshake, and a Node.js TLS server can register an SNICallback to choose a certificate or context based on that name. The report states that loadSNI() in _tls_wrap.js invokes this callback without a try/catch.

The researcher's finding, as summarised by the program, is that when an SNICallback throws synchronously on unexpected input, the exception bypasses the TLS error handlers and propagates as an uncaught exception. In Node.js an uncaught exception terminates the process, so a single crafted connection can take the server down.

The report lists the affected versions as all Node.js releases that received the CVE-2026-21637 fix: 20.x, 22.x, 24.x and 25.x. The condition is any TLS server where SNICallback may throw on unexpected servername input. The platform records the severity as high with a CVSS score of 7.5, and the report was disclosed on 23 April 2026. The report does not include a proof-of-concept request, a stack trace or a patch diff, and it does not state a bounty amount.

Root cause

The mistake is a missing exception boundary around a user-supplied callback. The TLS handshake code calls loadSNI(), which in turn calls the application's SNICallback. If that callback throws synchronously, for example because it parses the servername, looks it up in a map, or validates its format and rejects an unexpected value, the throw unwinds through the TLS internals. The TLS layer's own error handling is designed for handshake failures, not for exceptions raised by application code, so the exception is not converted into a TLS alert or a socket error. It surfaces as an uncaught exception at the process level.

The report frames this as an incomplete fix: the same class of problem was already addressed for the ALPN and PSK callbacks in CVE-2026-21637, but the SNI path was missed. The report does not say why the SNI path was missed.

Impact

An attacker who can open a TLS connection to the server can send a servername value that the application's SNICallback does not expect. If the callback throws on that value, the Node.js process exits. Because the trigger is a single handshake, this is a denial of service: repeated connections keep the service down. The report does not claim memory corruption, code execution or data exposure, and none should be inferred. The practical severity depends on whether the callback actually throws on attacker-controlled input, which the report states as a condition rather than a universal property.

How this kind of bug works

Callbacks registered by application code run inside a protocol state machine owned by the runtime or framework. The surrounding code usually has error handling for protocol violations, such as a malformed handshake, but that handling only covers errors it raises itself. A synchronous exception from a callback is a different control-flow path: it unwinds the stack past the protocol code and reaches whatever top-level handler exists. In a server process, the top-level handler is often "log and exit".

The bug class is therefore an unhandled exception on an attacker-reachable input path. It appears wherever a library invokes user code during parsing or negotiation and does not wrap that invocation. The input that reaches the callback is frequently attacker-controlled: SNI names, ALPN protocol lists, HTTP headers, content types, file extensions, query parameters. The callback then does ordinary things like dictionary lookups, parsing, or type assertions, any of which can throw.

Defences are straightforward in principle: wrap every invocation of user-supplied callbacks in try/catch and translate a throw into a protocol-level error, or validate and normalise the input before it reaches the callback. The difficulty is coverage. As this report shows, fixing one callback does not fix its siblings, and a fix that is applied path by path tends to leave gaps.

How to test for it

  1. Identify features where the server calls application code during connection setup: SNI certificate selection, ALPN protocol selection, pre-shared key lookups, client certificate verification hooks, header or content-type routing.
  2. Read the documentation for those hooks and note what input they receive and what the documented contract says about invalid values.
  3. Send values outside that contract: empty strings, very long strings, wildcard or dot-prefixed names, names with unusual characters, names that look like internal hostnames, and values that collide with lookup keys.
  4. Watch the server's availability rather than the response body. A positive result is the connection dropping and the service becoming unreachable, or a restart, not an error page.
  5. Confirm reproducibility: repeat the same input several times and check that the process dies each time, then verify that a normal input does not.

Common false positives are a per-connection error that the server handles gracefully, a rate limiter or WAF dropping the connection, and a crash caused by resource exhaustion from a very large input rather than by an exception. Distinguish these by checking whether the process restarts and whether small, well-formed but unexpected values also trigger it.

How it is fixed

Hunting notes

This class hides in negotiation and dispatch code: TLS hooks, HTTP/2 settings, content negotiation, template and view resolution, plugin registries, and deserialisation callbacks. Recon signals include documentation that describes user callbacks receiving raw protocol values, changelogs mentioning exception handling in a callback path, and prior CVEs in the same area, which often indicate an incomplete fix.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What happened, in plain words

Node.js is a program that runs JavaScript code on a server, outside the browser. Many websites and online services are built on it. This report is about a bug in Node.js itself, not in a website built with it, and it was disclosed on 23 April 2026. The platform records it as high severity with a CVSS score of 7.5.

The bug lives in the part of Node.js that handles TLS, the encryption layer behind the padlock icon in your browser. When your browser connects to a secure site, the two sides first agree on how to talk securely. That opening conversation is called the handshake. During the handshake, the browser can tell the server which site name it is trying to reach. That feature is called Server Name Indication, or SNI. It exists because one server can host many sites on one address, and the server needs to know which site's certificate to present.

A Node.js server can register a small piece of its own code, called a callback, to run when that site name arrives. The callback looks at the name and decides which certificate to use. A callback is simply a function the application hands to the library, with the understanding that the library will call it later. Think of leaving a phone number with a receptionist: you do not make the call, the receptionist does, when the right moment comes.

The report describes an incomplete fix for an earlier vulnerability, CVE-2026-21637. CVE is a public catalogue number for a known security flaw. In that earlier issue, two other callbacks used during the handshake, the ALPN and PSK callbacks, were made to tolerate errors thrown by application code. The SNI callback was missed. The report states that loadSNI() in _tls_wrap.js invokes the callback without a try/catch. A try/catch is a safety net in code: you put risky work in the try block, and if it fails, the catch block handles the failure instead of letting it escape.

When an SNI callback throws an error on unexpected input, that error skips the TLS error handling and becomes an uncaught exception. In Node.js an uncaught exception ends the process. So one crafted connection can take the whole server down. The report lists the affected versions as all releases that received the earlier fix: 20.x, 22.x, 24.x and 25.x. The condition is any TLS server where the SNI callback may throw on an unexpected site name.

The report does not include a proof-of-concept request, a stack trace or a patch diff, and it does not state a bounty amount.

Root cause

The mistake is a missing safety net around code supplied by the application. The handshake code calls loadSNI(), which calls the application's callback. If that callback throws, for example because it parses the site name, looks it up in a table, or checks its format and rejects an unexpected value, the error travels back up through the TLS internals. The TLS layer's error handling is built for handshake failures, not for errors raised by application code, so the error is not turned into a polite rejection of the connection. It surfaces at the top of the process, where the usual response is to log it and exit.

The report frames this as an incomplete fix: the same class of problem was already handled for the ALPN and PSK callbacks, but the SNI path was missed. The report does not say why the SNI path was missed.

Impact

Anyone who can open a TLS connection to the server can send a site name the callback does not expect. If the callback throws on that value, the Node.js process exits. Because a single handshake is enough, this is a denial of service: repeated connections keep the service down. The report does not claim memory corruption, code execution or data exposure, and none should be assumed. Whether a given server is actually vulnerable depends on whether its callback throws on attacker-controlled input, which the report states as a condition rather than a universal property.

In general, how this kind of bug works

Callbacks registered by application code run inside machinery owned by the runtime or framework. The surrounding code usually has error handling for protocol violations, such as a malformed handshake, but that handling only covers errors it raises itself. An error thrown by a callback is a different path: it travels past the protocol code and reaches whatever top-level handler exists. In a server process, that handler is often "log and exit".

The bug class is an unhandled exception on an input path an attacker can reach. It appears wherever a library calls user code during parsing or negotiation and does not wrap that call. The input reaching the callback is often attacker-controlled: site names, protocol lists, HTTP headers, content types, file extensions, query parameters. The callback then does ordinary things like table lookups, parsing or type checks, any of which can throw.

Defences are simple in principle: wrap every call to user-supplied callbacks in try/catch and turn a throw into a protocol-level error, or validate and normalise the input before the callback sees it. The difficulty is coverage. As this report shows, fixing one callback does not fix its siblings, and a fix applied path by path tends to leave gaps.

In general, how to test for it

  1. Identify features where the server calls application code during connection setup: SNI certificate selection, ALPN protocol selection, pre-shared key lookups, client certificate verification hooks, header or content-type routing.
  2. Read the documentation for those hooks and note what input they receive and what the documented contract says about invalid values.
  3. Send values outside that contract: empty strings, very long strings, wildcard or dot-prefixed names, names with unusual characters, names that look like internal hostnames, and values that collide with lookup keys.
  4. Watch the server's availability rather than the response body. A positive result is the connection dropping and the service becoming unreachable, or a restart, not an error page.
  5. Confirm reproducibility: repeat the same input several times and check that the process dies each time, then verify that a normal input does not.

Common false positives are a per-connection error the server handles gracefully, a rate limiter or web application firewall dropping the connection, and a crash caused by resource exhaustion from a very large input rather than by an exception. Distinguish these by checking whether the process restarts and whether small, well-formed but unexpected values also trigger it.

In general, how it is fixed

In general, hunting notes

This class hides in negotiation and dispatch code: TLS hooks, HTTP/2 settings, content negotiation, template and view resolution, plugin registries, and deserialisation callbacks. Recon signals include documentation describing user callbacks that receive raw protocol values, changelogs mentioning exception handling in a callback path, and prior CVEs in the same area, which often indicate an incomplete fix.

Glossary

  • Node.js: a program that runs JavaScript on a server rather than in a browser.
  • TLS: the encryption layer that secures connections, shown by the padlock in a browser.
  • Handshake: the opening conversation in which two sides agree how to communicate securely.
  • SNI (Server Name Indication): a way for a client to say which site name it wants during the handshake, so a server hosting many sites can pick the right certificate.
  • Certificate: a digital document a server presents to prove which site it is.
  • Callback: a function an application hands to a library, which the library calls later.
  • try/catch: a code construct that runs risky work and handles a failure instead of letting it escape.
  • Exception: an error raised while code is running.
  • Uncaught exception: an error that nothing handles; in Node.js it ends the process.
  • CVE: a public catalogue number for a known security flaw.
  • ALPN: a handshake feature for agreeing which application protocol to use.
  • PSK: pre-shared key, a secret both sides already know, used in some handshake modes.
  • Denial of service: making a service unavailable to its normal users.
  • CVSS: a scoring system that rates the severity of a vulnerability.
  • Proof of concept: a concrete demonstration that a vulnerability can be triggered.
  • Stack trace: the list of function calls that led to an error.
  • Patch diff: the before-and-after view of the code change that fixes a bug.
  • Regression test: a test that checks a fixed bug stays fixed.
  • Web application firewall (WAF): a filter that inspects traffic and can block suspicious requests.
  • Rate limiter: a control that drops or slows traffic arriving too quickly.

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.