Skip to content
DoS Write-up Advanced

Vulnerabilities in NodeJS C/C++ add-on extensions

The article describes common vulnerability patterns in Node.js C/C++ add-ons, such as unhandled exceptions, reachable assertions, unchecked data types, and memory leaks, which can cause denial of service or information disclosure. It also lists six CVEs found in npm packages as a result of the research.

Alessio Della Libera Follow

Published on snyk.io

One of the main goals of this research was to explore C/C++ vulnerabilities in the context of NodeJS npm packages. The focus will be on exploring and identifying classic vulnerabilities like Buffer Overflow, Denial of Service (process crash, unchecked types), and Memory Leakages in the context of NodeJS C/C++ addons…

Alessio Della Libera, on snyk.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the add-on code fails to validate JavaScript inputs and error conditions, leading to unhandled exceptions, failed assertions, type coercion issues, or incorrect string lengths.

Impact

An attacker could cause a denial of service by crashing the Node.js process, or potentially disclose memory contents through crafted inputs.

What the attacker needed

Ability to call the vulnerable add-on function

The fix

The article suggests checking return values instead of using asserts, properly handling exceptions, validating types before coercion, and using NAPI_AUTO_LENGTH for string creation.

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 write-up has not been written yet. The Original tab links to the source.

Node.js add-ons are native C/C++ modules that JavaScript can call. If the C/C++ code does not carefully check what JavaScript sends it, a malicious input can crash the whole Node.js process or leak memory. This article explains those mistakes and shows how to avoid them.

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 third-party modules

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.