NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · npm

CVE-2026-118778: Forge: TLS client crash when the server sends no certificate

mediumCVSS 3.1 5.9GHSA-525v-9gp9-w22h

node-forge 1.4.0 and earlier has a TLS client that throws an uncaught TypeError when the server sends no Certificate message. A malicious server or an on-path attacker can crash a Node.js process that uses the forge TLS client. There is no authentication bypass. Upgrade to node-forge 1.4.1.

Published Oct 30, 2026 · Analysis Oct 31, 2026

What an attacker can do

After ServerHelloDone, tls.handleServerHelloDone() in lib/tls.js should reject a server that sent no certificate with a fatal insufficient_security alert. The check tested c.serverCertificate, which is never set. The certificate lives in c.session.serverCertificate, so the check never ran. The handshake went on to tls.createClientKeyExchange(), which reads c.session.serverCertificate.publicKey and throws TypeError: Cannot read properties of null (reading 'publicKey'). The exception leaves connection.process() without calling the verify or error callbacks (CWE-476).

The attacker is the server the application connects to, or someone on the network path who strips the Certificate message from the unauthenticated handshake. process() is normally called from a socket data handler, so the uncaught exception ends the Node.js process.

The maintainers state there is no authentication bypass: without a certificate the client cannot build its RSA key exchange, so the handshake cannot finish. There is no confidentiality or integrity impact. Only applications using forge.tls.createConnection with server: false are affected. Applications using Node.js's own TLS are not.

Who is affected

node-forge 1.4.0 and earlier is affected, in applications that use the forge TLS client via forge.tls.createConnection({server: false, ...}). Check the installed version, including transitive copies:

npm ls node-forge

Then search your code for tls.createConnection.

node-forge

Ecosystem
npm
Affected
<= 1.4.0
Fixed in
1.4.1
Check
npm ls node-forge

How to fix it

Upgrade to node-forge 1.4.1.

npm install [email protected]

The fix (commit 7be9fbd) reads c.session.serverCertificate and always fails the handshake when it is missing. It still calls verify so the application can customize the alert. The handshake fails even if verify returns true, because the key exchange needs the certificate. Workaround from the advisory: wrap the calls to connection.process() in a try/catch and close the connection when it throws.

How to tell if you were hit

Look for process crashes with the message TypeError: Cannot read properties of null (reading 'publicKey') and a stack trace through createClientKeyExchange in lib/tls.js. Repeated restarts of a service right after it opens outbound TLS connections point to this. On patched versions, the error callback receives "No server certificate provided. Not enough security."

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

The forge TLS client's check for a missing server certificate read the wrong property and never ran. A malicious TLS server, or an on-path attacker who removes the server's Certificate message, can make connection.process() throw a TypeError, which crashes applications that use the forge TLS client. Fixed in node-forge 1.4.1.

Details

After ServerHelloDone, tls.handleServerHelloDone() in lib/tls.js is meant to reject a server that sent no certificate with a fatal insufficient_security alert, after consulting the application's verify callback. The check tested c.serverCertificate, which is never set (the certificate is stored as c.session.serverCertificate), so it never ran. The client state machine allows ServerHelloDone directly after ServerHello, so the handshake continued to tls.createClientKeyExchange(), which reads c.session.serverCertificate.publicKey and throws a TypeError on the null certificate. The exception propagates out of connection.process() without calling the verify or error callbacks.

There is no authentication bypass: without a server certificate the client cannot build its RSA key exchange, so the handshake cannot complete.

The fix reads c.session.serverCertificate and always fails the handshake in that case, still calling verify so the application can customize the alert. Failing even when verify returns true is needed because the key exchange requires the certificate.

Patches

Fixed in node-forge 1.4.1. The TLS client fails the handshake with an insufficient_security alert when the server sends no certificate.

Workarounds

Catch exceptions thrown by connection.process() in the code that feeds it network data, and close the connection when one occurs.

Credits

Reported by @arpitjain099.

Proof of concept

Connect a forge TLS client (forge.tls.createConnection({server: false, ...})) to a server whose first flight contains ServerHello and ServerHelloDone but no Certificate message. For example, run a forge TLS server and remove the Certificate handshake message (type 11) from its first flight before passing it to the client's process().

On 1.4.0 the client's process() throws "TypeError: Cannot read properties of null (reading 'publicKey')", and the verify and error callbacks are not called. On 1.4.1 the client calls verify with insufficient_security and no certificates, calls error with "No server certificate provided. Not enough security.", sends a fatal alert and closes the connection.

Regression tests are in tests/unit/tls.js ("missing server certificate").

Impact

Applications that use the forge TLS client (forge.tls.createConnection with server: false) are affected. A malicious server the application connects to, or an on-path attacker who can modify the unauthenticated handshake, can make the client throw from connection.process(). Since process() is normally called from a socket data handler, the uncaught exception terminates a Node.js process. There is no confidentiality or integrity impact. Applications using Node.js's own TLS implementation are not affected.

Credited to arpitjain099.

Questions

Does this let an attacker skip certificate validation?

No. The advisory says there is no authentication bypass. Without a server certificate the client cannot complete the RSA key exchange.

Are apps using Node.js's built-in tls module affected?

No. Only the forge TLS client is affected.

Which version fixes CVE-2026-118778?

node-forge 1.4.1. A try/catch around connection.process() is the stop-gap.

Is it exploited in the wild?

No source reports it, and it is not in CISA's KEV catalog.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More npm vulnerabilities

All npm entries