CVE-2024-0727
Patch Available.
This Vulnerability has been fixed in the Never-Ending Support (NES) version offered by HeroDevs.
Overview
Node.js is an asynchronous, event-driven JavaScript runtime designed for building scalable network applications. The official Node.js distributions do not link against a system cryptography library: they compile and ship their own copy of OpenSSL at deps/openssl in the Node.js source tree, and the built-in crypto and tls modules are bindings over that bundled copy. A vulnerability in the bundled OpenSSL therefore affects Node.js directly, whether or not Node.js itself contains any new code.
A NULL pointer dereference vulnerability (CVE-2024-0727) has been identified in the OpenSSL library bundled with Node.js. A PKCS12 file bundles certificates and private keys, and the PKCS12 specification allows some of its fields to be NULL. However, OpenSSL's PKCS12 decoding code does not check for those NULL fields, so a maliciously formatted PKCS12 file makes OpenSSL dereference a NULL pointer. The Node.js process then crashes, which an attacker can use for denial of service.
This behaviour maps to CWE-476 (NULL Pointer Dereference), where code uses a pointer it expects to be valid but which is actually NULL, typically crashing the program. In OpenSSL, the PKCS12 unpacking functions read the contents of a structure the file left empty. For a Node.js server, that crash takes down the whole process.
Exploitation requires an attacker who can get a crafted PKCS12 (.pfx or .p12) file loaded by the application. In Node.js, PKCS12 data reaches OpenSSL through the pfx option of tls.createSecureContext() and the APIs built on it, such as tls.createServer() and https.createServer(), which pass the data to OpenSSL's PKCS12_parse(). Applications that only load PKCS12 files they created themselves are not exposed. This issue affects the Node.js release lines up to 16.x, 17.x and 19.x in full, and 18.x, 20.x and 21.x before the versions listed above.
Details
Module Info
- Product: Node.js
- Affected packages: node (bundles OpenSSL under deps/openssl)
- Affected versions: <=16.20.2 >=17.0.0 <=17.9.1 >=18.0.0 <18.19.1 >=19.0.0 <=19.9.0 >=20.0.0 <20.11.1 >=21.0.0 <21.6.2
- GitHub repository: https://github.com/nodejs/node
- Published packages: https://nodejs.org/en/download
- Package manager: Not applicable; Node.js is distributed as runtime builds from nodejs.org rather than as a published npm package
- Fixed in: Node.js 18.19.1, 20.11.1, and 21.6.2 (upstream fixes, released February 14, 2024 with OpenSSL 3.0.13+quic1, while those lines were still supported); Node.js NES v16.20.3 (16.x line, shipped July 30, 2024), v14.21.4 (14.x line, shipped August 24, 2024), and v12.22.13 (12.x line, shipped November 10, 2025), none of which received an upstream fix before reaching End-of-Life
Vulnerability Info
This Medium-severity vulnerability is found in the PKCS12 decoding code of the OpenSSL library that Node.js bundles at deps/openssl, in every Node.js release whose bundled OpenSSL predates 3.0.13 or lacks the equivalent 1.1.1 backport. NVD assigns a CVSS v3.1 score of 5.5.
When OpenSSL unpacks a PKCS12 structure, it should confirm that each optional content field is present before reading from it. The affected functions are PKCS12_parse(), PKCS12_unpack_p7data(), PKCS12_unpack_p7encdata(), PKCS12_unpack_authsafes() and PKCS12_newpass(). In the vulnerable implementation they read those fields without checking them, so a file that leaves one empty causes a NULL pointer dereference and an immediate crash. The fix adds the missing checks and returns a decoding error instead. See the OpenSSL 3.0 fix commit for the exact change.
An attacker would need to supply the PKCS12 file the application loads, for example on a platform that lets users upload their own TLS certificate bundle, or a tool that opens .pfx files from untrusted sources.
Note: Because the PKCS12 data must come from an untrusted source, applications that only load their own certificate bundles through the pfx option are not exposed by this issue.
Mitigation
The Node.js 12.x, 14.x, 16.x, 17.x, 18.x, 19.x, 20.x and 21.x release lines are all past their support window and will not receive further upstream updates. Node.js 12.x reached End-of-Life on April 30, 2022; Node.js 14.x on April 30, 2023; Node.js 16.x on September 11, 2023; Node.js 17.x on June 1, 2022; Node.js 18.x on April 30, 2025; Node.js 19.x on June 1, 2023; Node.js 20.x on April 30, 2026; and Node.js 21.x on June 1, 2024. For more information see here.
Users of the affected components should apply one of the following mitigations:
- Upgrade to a currently supported Node.js LTS release (22.x or 24.x), both of which bundle an OpenSSL version that already includes this fix.
- Migrate affected applications away from the End-of-Life Node.js release lines.
- Leverage a commercial support partner like HeroDevs for post-EOL security support, through Node.js NES.
Credits
- Bahaa Naamneh from Crosspoint Labs (finder)
- Matt Caswell from the OpenSSL project (remediation developer)