Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
MEDIUM severity

GHSA-pqhp-25j4-6hq9 smol-toml

MEDIUMFix: squirrelchat/smol-toml@405108b

GHSA-pqhp-25j4-6hq9 is a medium-severity (CVSS 5.3) remote code execution vulnerability in smol-toml. A fix is available for smol-toml — see the affected versions and patch details below.

smol-toml has a Denial of Service via malicious TOML document using deeply nested inline tables

Published
Nov 22, 2024
Updated
Nov 22, 2024
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Nov 22, 2024 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

2Kother npm packages depend on this — each one inherits the vulnerability until it's patched upstream
smol-tomlnpm
25.1Mdownloads / week

Description

Summary

An attacker can send a maliciously crafted TOML to cause the parser to crash because of a stack overflow caused by a deeply nested inline structure. A similar problem occurs when attempting to stringify deeply nested objects.

The library does not limit the maximum exploration depth while parsing or producing TOML documents, nor does it offer a way to do so.

Proof of concept

require("smol-toml").parse("e=" + "{e=".repeat(9999) + "{}" + "}".repeat(9999))

Impact

Applications which parse arbitrary TOML documents may suffer availability issues if they receive malicious input. If uncaught, the crash may cause the application itself to crash. The impact is deemed minor, as the function is already likely to throw errors on invalid input and therefore to properly handle errors.

Due to the design of most JavaScript runtimes, the uncontrolled recursion does not lead to excessive memory usage and the execution is quickly aborted.

As a reminder, it is strongly advised when working with untrusted user input to expect errors to occur and to appropriately catch them.

Patches

Version 1.3.1 offers a mechanism to limit the exploration depth before halting with a TomlError when parsing, with a default cap of 1000. A same mechanism has been implemented for stringifying objects.

Please note that the parser will still throw an error upon such cases. It is, however, a now-controlled and documented behavior of the library.

Workarounds

Wrap all invocations of parse and stringify in a try/catch block.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
📦npmsmol-tomlall versions1.3.1npm install smol-toml@1.3.1

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for smol-toml, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update smol-toml to 1.3.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-pqhp-25j4-6hq9 is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 Security's impact-aware SCA analyses which vulnerable code paths your application actually calls, so a match like GHSA-pqhp-25j4-6hq9 can be triaged on real exposure rather than presence alone.

Tailored to GHSA-pqhp-25j4-6hq9. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

### Summary An attacker can send a maliciously crafted TOML to cause the parser to crash because of a stack overflow caused by a deeply nested inline structure. A similar problem occurs when attempting to stringify deeply nested objects. The library does not limit the maximum exploration depth while parsing or producing TOML documents, nor does it offer a way to do so. ### Proof of concept ```js require("smol-toml").parse("e=" + "{e=".repeat(9999) + "{}" + "}".repeat(9999)) ``` ### Impact Applications which parse arbitrary TOML documents may suffer availability issues if they receive malici
O3 Security · Impact-Aware SCA

Is GHSA-pqhp-25j4-6hq9 in your dependencies?

O3 Security finds GHSA-pqhp-25j4-6hq9 across npm dependencies, including transitive ones, and its impact-aware SCA ranks findings by whether your code actually calls the vulnerable path.

GHSA-pqhp-25j4-6hq9: smol-toml | O3 Security