GHSA-R4XH-JQRQ-34V2

GHSA-R4XH-JQRQ-34V2 is a medium-severity security vulnerability in smol-toml (npm), affecting versions <= 1.8.0. It is fixed in 1.9.0.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

smol-toml: Quadratic-time parse() from parseKey rescanning to end of document on each key line

parse() has a quadratic-time path in parseKey, reachable on default options with ordinary valid input. For every key line and table-header line, parseKey (dist/struct.js, lines 58 and 86) finds the dotted-key separator with ctx.s.indexOf('.', ctx.p), where ctx.s is the whole document. When a key has no . ahead of it, that search runs all the way to the end of the input, and the result is then clamped back to the line terminator endPtr - so everything scanned past the current line is wasted. parseKey runs once per line, so a document of N dot-free keys costs O(n^2).

The most ordinary TOML shape triggers it: a flat list of key = value lines, or a repeated [[a]] table. No dotted keys, no special options, valid input throughout.

Proof of concept

import { parse } from 'smol-toml'

let doc = ''
for (let i = 0; i < 256000; i++) doc += 'k' + i + ' = 1\n'

console.time('parse')
parse(doc) // ~2.8 MB of valid TOML, default options
console.timeEnd('parse')

Doubling the line count roughly quadruples the time:

lines size parse()
32k 0.3 MB 0.3 s
64k 0.7 MB 1.0 s
128k 1.4 MB 3.5 s
256k 2.8 MB 14 s

Workarounds

Limit the maximum document size accepted when parsing arbitrary documents.

Impact

Any service that runs parse() on attacker-supplied TOML can be stalled. The work is synchronous, so it blocks the whole event loop, and the quadratic is unbounded: a ~7 MB body pins a core for about a minute, larger bodies for several.

GHSA-R4XH-JQRQ-34V2 has a CVSS score of 5.3 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.9.0); upgrading removes the vulnerable code path.

Affected versions

smol-toml (<= 1.8.0)

Security releases

smol-toml → 1.9.0 (npm)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Version 1.9.0 uses a different implementation for parsing keys which is strictly linear.

Frequently Asked Questions

  1. What is GHSA-R4XH-JQRQ-34V2? GHSA-R4XH-JQRQ-34V2 is a medium-severity security vulnerability in smol-toml (npm), affecting versions <= 1.8.0. It is fixed in 1.9.0.
  2. How severe is GHSA-R4XH-JQRQ-34V2? GHSA-R4XH-JQRQ-34V2 has a CVSS score of 5.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of smol-toml are affected by GHSA-R4XH-JQRQ-34V2? smol-toml (npm) versions <= 1.8.0 is affected.
  4. Is there a fix for GHSA-R4XH-JQRQ-34V2? Yes. GHSA-R4XH-JQRQ-34V2 is fixed in 1.9.0. Upgrade to this version or later.
  5. Is GHSA-R4XH-JQRQ-34V2 exploitable, and should I be worried? Whether GHSA-R4XH-JQRQ-34V2 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether GHSA-R4XH-JQRQ-34V2 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix GHSA-R4XH-JQRQ-34V2? Upgrade smol-toml to 1.9.0 or later.

Other vulnerabilities in smol-toml

Stop the waste.
Protect your environment with Kodem.