Vulnerabilities in pkg:npm/smol-toml

PACKAGE
Advisory Summary

GHSA-r4xh-jqrq-34v2 is a MODERATE (CVSS 5.3) quadratic-time parse() from parsekey rescanning vulnerability (CWE-407: Inefficient Algorithmic Complexity) affecting smol-toml libraries in the npm ecosystem. The issue involves quadratic-time parse() from parsekey rescanning to end of document on each key line. Remediation is available by upgrading affected packages to version 1.9.0.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/smol-toml

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/smol-toml. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-r4xh-jqrq-34v2 - MODERATE smol-toml: Quadratic-time parse() from parseKey rescanning to end of document on each key line
GHSA-7w5x-hrqm-74c2 CVE-2026-85730 HIGH smol-toml: Denial of Service via malformed TOML documents
GHSA-v3rj-xjv7-4jmq - MODERATE smol-toml: Denial of Service via TOML documents containing thousands of consecutive commented lines
GHSA-pqhp-25j4-6hq9 - MODERATE smol-toml has a Denial of Service via malicious TOML document using deeply nested inline tables

GHSA-r4xh-jqrq-34v2 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-r4xh-jqrq-34v2
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-407: Inefficient Algorithmic Complexity
Affected Product smol-toml
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability Low (A:L)

How to Fix GHSA-r4xh-jqrq-34v2

To remediate this vulnerability, upgrade all affected smol-toml dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

smol-toml fixed: 1.9.0
npm install smol-toml@1.9.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls smol-toml

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-r4xh-jqrq-34v2, inspect your project dependencies using npm:

npm ls smol-toml

Analyze the terminal output to locate any version of smol-toml in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.9.0), your application is affected.

Note: The npm ls smol-toml command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-407: Inefficient Algorithmic Complexity, where 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. In smol-toml, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary `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 ```js 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 | ### 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. ### Patches Version 1.9.0 uses a different implementation for parsing keys which is strictly linear. ### Workarounds Limit the maximum document size accepted when parsing arbitrary documents.

GHSA-r4xh-jqrq-34v2 Affected smol-toml Versions

1 component(s)
Fixed Versions:
1.9.0
Product / Package Ecosystem Affected Versions Fixed Version
smol-toml
npm
< 1.9.0
1.9.0

References

Frequently Asked Questions

What is GHSA-r4xh-jqrq-34v2?
GHSA-r4xh-jqrq-34v2 is a security vulnerability in smol-toml involving Quadratic-time parse() from parseKey rescanning to end of document on each key line under CWE-407: Inefficient Algorithmic Complexity.
Which smol-toml versions are affected?
Affected versions include releases prior to 1.9.0 across affected packages: smol-toml.
What version fixes GHSA-r4xh-jqrq-34v2?
Upgrading to 1.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is smol-toml affected?
Yes, smol-toml is affected in releases prior to 1.9.0. Upgrade your dependency to 1.9.0 or later.
What is the CVSS score of GHSA-r4xh-jqrq-34v2?
GHSA-r4xh-jqrq-34v2 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with GHSA-r4xh-jqrq-34v2?
GHSA-r4xh-jqrq-34v2 is classified under CWE-407: Inefficient Algorithmic Complexity (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.).
How can I check npm dependencies for GHSA-r4xh-jqrq-34v2?
Run the dependency tree command: 'npm ls smol-toml'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r4xh-jqrq-34v2",
  "modified" : "2026-10-05T23:41:14Z",
  "published" : "2026-10-05T23:41:14Z",
  "aliases" : [ ],
  "summary" : "smol-toml: Quadratic-time parse() from parseKey rescanning to end of document on each key line",
  "details" : "### Summary\n\n`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).\n\nThe 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.\n\n### Proof of concept\n\n```js\nimport { parse } from 'smol-toml'\n\nlet doc = ''\nfor (let i = 0; i < 256000; i++) doc += 'k' + i + ' = 1\\n'\n\nconsole.time('parse')\nparse(doc) // ~2.8 MB of valid TOML, default options\nconsole.timeEnd('parse')\n```\n\nDoubling the line count roughly quadruples the time:\n\n| lines | size | parse() |\n|---|---|---|\n| 32k | 0.3 MB | 0.3 s |\n| 64k | 0.7 MB | 1.0 s |\n| 128k | 1.4 MB | 3.5 s |\n| 256k | 2.8 MB | 14 s |\n\n### Impact\nAny 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.\n\n### Patches\nVersion 1.9.0 uses a different implementation for parsing keys which is strictly linear.\n\n### Workarounds\nLimit the maximum document size accepted when parsing arbitrary documents.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "smol-toml"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.9.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.8.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/squirrelchat/smol-toml/security/advisories/GHSA-r4xh-jqrq-34v2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/squirrelchat/smol-toml/commit/99102aa57fc932f760ea9c15b4cf1c181f952d24"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/squirrelchat/smol-toml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/squirrelchat/smol-toml/releases/tag/v1.9.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-407" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-05T23:41:14Z",
    "nvd_published_at" : null
  }
}