toml-node: Quadratic-complexity DoS via long dotted keys or table paths in toml.parse() (CVE-2026-114143)
Published Last modified Sources: CVE.org, Hersteller
What is affected, what to do
Update BinaryMuse Toml-node to version 5.0.1.
- Affected
- BinaryMuse Toml-node
lt *..5.0.1
- BinaryMuse Toml-node
- Fixed in
- BinaryMuse Toml-node
5.0.1
- BinaryMuse Toml-node
Not sure whether and how you are affected? Ask a question about this vulnerability
Metrics
8.7
Priority
XIEM Effective CVSS: highest available CVSS rating from NVD and vendor data.
Source: Vendor (CNA), CVSS v4
8.7
CVSS v4
Severity High on the scale from 0 to 10.
Source: CVE.org, Hersteller
—
EPSS score
No value is available for this vulnerability.
Show all metrics
- Severity
- High
Priority (0–325)
The priority score is a consolidated metric that condenses several individual signals into a single, action-guiding ranking: technical severity (CVSS), exploitation likelihood (EPSS), known-exploited status (KEV) and the context of the affected asset. The aim is to answer the only truly important question in vulnerability management: what first?
Read in glossary- 73.50 Methodology
Exploit maturity
An exploit is code or a technique that specifically uses a concrete vulnerability to force unintended behaviour — such as executing code or escalating privileges. It is the tool that turns a theoretical flaw into a practical attack.
Read in glossary- no public PoC known
XIEM Effective CVSS
XIEM® is the tiered managed-security operating model from NEOSEC and a registered trademark of NEOSEC GmbH. It extends classic SIEM — the central collection, normalisation and correlation of security-relevant events — with endpoint forensics, network visibility and deception technology, and consolidates them into three building tiers: Sentry, Orchestrate and Command.
Read in glossary- 8.7 Methodology
CVSS v4
CVSS is the globally established, open standard for assessing the technical severity of a vulnerability on a scale from 0 to 10. It describes how easily a flaw can be exploited and what damage it can cause — but not how likely its actual exploitation is. CVSS and the complementary EPSS deliberately answer different questions.
Read in glossary- 8.7
KEV status
The KEV catalogue is a list maintained by the US authority CISA of vulnerabilities for which active exploitation in the wild has been confirmed. It answers not the question „how severe?“ but „is it already being attacked?“ — thereby sharply prioritising patching.
Read in glossary- —
- Published
CWE
CWE is a catalogue of typical weakness types in software and hardware — such as flawed input validation, unsafe memory handling or poor authentication. Where a CVE names a concrete vulnerability in a concrete product, a CWE describes the underlying class of defect.
Read in glossary- CWE-407
Detection rules
No NEOSEC detection rule is available for this vulnerability yet.
Classification under NIS2 and CRA
Rule-based classification from exploitation status and severity. It does not replace a case-by-case assessment.
NIS2
NIS2 is EU Directive (EU) 2022/2555 to raise the level of cybersecurity across the Union. It substantially broadens obligations compared with the first NIS directive: more sectors, mandatory risk management, staged reporting duties and personal accountability of senior management.
Read in glossary- High technical severity: assess and remediate the vulnerability in vulnerability handling under Art. 21(2)(e) NIS2 and document the decision.
CRA
The CRA is EU Regulation (EU) 2024/2847 setting horizontal cybersecurity requirements for „products with digital elements“ — from industrial controllers and software to connected consumer devices. For the first time manufacturers must ensure security across the entire product lifecycle, handle vulnerabilities and provide security updates.
Read in glossary- From 11.12.2027, Annex I Part II CRA requires manufacturers of affected products with digital elements to handle vulnerabilities without delay and provide security updates.
ISO/IEC 27001
ISO/IEC 27001 is the internationally leading standard for an information security management system (ISMS). It describes a risk-based, process-oriented framework to systematically plan, implement, review and improve information security.
Read in glossary- Control A.8.8, management of technical vulnerabilities: assess relevance to your systems, plan remediation and keep evidence.
Description
Summary
toml.parse() is vulnerable to a quadratic-complexity (O(n²)) denial-of-service via a single
long dotted key, table header, or inline-table key. A ~100KB crafted document causes a
multi-second synchronous hang; a ~200KB document crashes the Node.js process outright with an
uncatchable out-of-memory error. This is a separate, unpatched code path from the previously
fixed stack-overflow DoS (GHSA-82x6-q7mm-w9cf) — it requires no array/inline-table nesting at
all, and is confirmed unaffected by the maxDepth option that fixed that earlier issue.
Affected component / version
- Package:
toml(npm), repositoryBinaryMuse/toml-node - Functions:
assign(),deepRef(),setNestedKey()inlib/compiler.js - Confirmed present in the audited checkout at commit
1b2ac40(2026-07-16), one commit past thev5.0.0tag (a changelog-only change) — i.e. present inv5.0.0, the latest release. Not exhaustively verified against every prior release, but the affected functions are unrelated tov5.0.0's BigInt/Temporal changes (perCHANGELOG.md), so the defect likely predates that release as well.
Details
toml.parse(input, options) (index.js:5-9) forwards the caller-supplied string to
parser.parse() and then compiler.compile() with no length or structural validation.
Inside lib/compiler.js, three separate functions each walk a dotted key's segments in a
for loop and, on every iteration, recompute the full path-prefix string from scratch:
assign()(lines 69-107, the sink at line 81):var intermediatePath = makeFullPath(keys.slice(0, i + 1));— reached for top-level dotted-key assignments likea.b.c = 1.deepRef()(lines 247-281, the sink at line 252): the identical pattern viapathKey(keys.slice(0, i + 1))— reached from table headers[a.b.c]and array-of-tables[[a.b.c]]viasetPath()/addTableArray().setNestedKey()(lines 184-202, the sink at line 187): the identical pattern — reached from inline-table dotted keys liket = { a.b.c = 1 }.
keys.slice(0, i + 1) allocates a new array of length i; pathKey()/makeFullPath()
(lines 311-317) then does .map(quoteDottedString).join("."), also O(i). Since this runs on
every one of the n segments of a dotted key, total work is O(1 + 2 + ... + n) = O(n²), not
O(n). The string is computed unconditionally on the happy path (only ever used if an error
is about to be thrown), so there is no early exit that makes this cheap in practice.
No limit exists anywhere on dotted-key segment count: dot_ended_table_key_part+ and
inline_dot_key_part+ in src/toml.pegjs (lines 122, 311) are unbounded + repetitions,
parsed iteratively rather than through the grammar's value rule — so the existing
MAX_DEPTH/maxDepth nesting guard (src/toml.pegjs:141-151, enforced in the generated
lib/parser.js:1022) does not apply to key length at all. We confirmed this directly: setting
options.maxDepth: 1 (the strictest possible value) against a 16,000-segment key produced no
measurable timing difference from the unrestricted case.
Proof of Concept
const toml = require('toml');
// n-segment dotted key: "k0.k1.k2. ... .k{n-1} = 1"
function segKey(n) {
const parts = [];
for (let i = 0; i < n; i++) parts.push('k' + i);
return parts.join('.') + ' = 1\n';
}
// ~100.9 KB input -- takes ~6.6-6.8 seconds
toml.parse(segKey(16000));
// ~200 KB input -- crashes the Node process:
// "FATAL ERROR: Ineffective mark-compacts near heap limit - JavaScript heap out of memory"
toml.parse(segKey(32000));
Measured timings (Node v22, direct execution against this repo):
| n (segments) | input size | time |
|---|---|---|
| 1,000 | ~4.9 KB | 34 ms |
| 8,000 | ~46.9 KB | 1.6 s |
| 16,000 | ~100.9 KB | 6.8 s |
| 32,000 | ~200 KB | process crash (OOM) |
Doubling n from 8,000→16,000 roughly quadruples runtime (~4.2x), the signature of O(n²)
rather than the expected O(n) (~2x). Independently reproduced with the identical scaling
signature for the table-header variant ([k0. ... .k15999], exercising deepRef()) and the
inline-table variant (t = { k0. ... .k15999 = 1 }, exercising setNestedKey()).
We also generalized this into a property-based fuzzing harness (fast-check, run under Node) that automatically tests the "doubling input size should not more than roughly double parse time" invariant across 12 structural dimensions of the grammar/compiler; it independently re-flags all three code paths above on every run, with no additional dimension confirmed vulnerable after follow-up investigation. The harness is available on request.
Impact
Node.js is single-threaded — a synchronous multi-second-to-crashing parse() call blocks the
entire event loop of the process calling it, stalling every other request/operation that
process is handling, not just the attacker's own. At the upper end this is not merely a hang:
an uncaught, process-terminating out-of-memory crash from a ~200KB attacker-supplied string is
a full denial of service requiring no authentication — just the ability to get one string
parsed by an application using this library (config upload, API request body, imported
manifest, or any of this library's intended use cases).
Suggested remediation
Build the path prefix as an incrementally-extended string as the loop walks each segment
(append one already-quoted segment per iteration to a running string) instead of re-slicing an
array and re-joining the entire prefix from scratch on every iteration. For example, in
assign():
function assign(node) {
var keys = node.key;
var value = node.value;
var off = node.offset;
if (!Array.isArray(keys)) keys = [keys];
var reduced = reduceValueNode(value);
var target = context;
var pathStr = pathKey(currentPath); // computed once, not per segment
for (var i = 0; i < keys.length - 1; i++) {
var k = keys[i];
var quotedK = quoteDottedString(k);
var intermediatePath = pathStr ? pathStr + "." + quotedK : quotedK; // O(new segment), not O(i)
pathStr = intermediatePath;
// ...same conditional logic as today, using intermediatePath
target = target[k];
}
// ...
}
The identical treatment applies to deepRef() and setNestedKey(). As defense-in-depth,
consider also capping total key-segment count or overall input size, the same way maxDepth
already caps nesting.
Credit
Discovered and reported by SecDim Security Research secdim.com | @secdim | security@secdim.com
Source: NVD (NIST), cvelistv5, GitHub Security Advisories
Affected products
The following versions are affected. Older releases of the same product line are also vulnerable unless stated otherwise.
| Vendor | Product | Affected versions | Fixed in |
|---|---|---|---|
| BinaryMuse | toml-node |
|
|
| npm | toml |
|
|
Weakness classes (CWE)
CWE-407Inefficient Algorithmic Complexity
Class
An algorithm in a product has an inefficient worst-case computational complexity that may be detrimental to system performance and can be triggered by an attacker, typically using crafted manipulations that ensure that the worst case is being reached.
Entry at MITRE CWE-407
References & sources
- github.comBinaryMuse/toml-node/security/advisories/GHSA-9j65-hcg3-gc64x_refsource_CONFIRM
- github.comBinaryMuse/toml-node/commit/609c873fffea0a27ebe5b4dd098eed2b3da…x_refsource_MISC
- github.comBinaryMuse/toml-node/releases/tag/v5.0.1x_refsource_MISC
Reanalysis & status changes
Chronological NVD audit events for this CVE — reanalyses, CVSS updates, CPE diffs.
New CVE Receivedsecurity-advisories@github.com
- Description: after toml-node is a TOML parser for Node.js and the browser. Prior to 5.0.1, toml.parse() repeatedly slices and rejoins every path prefix in lib/compiler.js while processing long dotted keys, table headers, array-of-tables headers, and inline-table keys in assign(), deepRef(), and setNestedKey(). The resulting quadratic work can block the Node.js event loop for several seconds, and sufficiently long paths can terminate the process through memory exhaustion. The maxDepth option does not limit key-segment count and therefore does not mitigate this path. This issue is fixed in version 5.0.1.
- CVSS V4.0: after AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- CWE: after CWE-407
- Affected: after New affected value received. <a href="https://github.com/CVEProject/cvelistV5/blob/main/cves/2026/114xxx/CVE-2026-114143.json">CVE-2026-114143</a>
Embed badge
Show the severity and KEV status of this vulnerability on your site – with a link back here. The image is updated hourly.
<a href="https://intel.neosec.eu/en/cve/CVE-2026-114143"><img src="https://intel.neosec.eu/badge/cve/CVE-2026-114143.svg?lang=en" alt="CVE-2026-114143 – NEOSEC Intel" height="20"></a>