GHSA-v3rj-xjv7-4jmq smol-toml: Denial of Service via TOML documents containing thousands of consecutive commented lines

Not scored Published

An attacker can crash applications parsing untrusted TOML by sending documents with thousands of consecutive comments, causing a stack overflow.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is GHSA-v3rj-xjv7-4jmq?

GHSA-v3rj-xjv7-4jmq is a denial of service vulnerability in smol-toml, published on 25 Mar 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

Summary

An attacker can send a maliciously crafted TOML to cause the parser to crash, because of a stack overflow caused by thousands of consecutive commented lines.

The library uses recursion internally while parsing to skip over commented lines, which can be exploited to crash an application that is processing arbitrary TOML documents.

Proof of concept

require("smol-toml").parse('# comment\n'.repeat(8000) + 'key = "value"')

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. Downstream users are supposed to properly handle errors in such situations.

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.6.1 uses a different approach for parsing comments, which no longer involves recursion.

Workarounds

Wrap all invocations of parse and stringify in a try/catch block when dealing with untrusted user input.

Which versions are affected by GHSA-v3rj-xjv7-4jmq?

2 open source packages ship an affected version, including smol-toml.

PackageAffectedFixed in
smol-toml npmAll versions1.6.1
smol-toml npmAll versions1.6.1

How do I fix GHSA-v3rj-xjv7-4jmq?

Upgrade smol-toml to 1.6.1 or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is GHSA-v3rj-xjv7-4jmq being exploited?

There is no known exploitation of GHSA-v3rj-xjv7-4jmq in the wild and no public exploit code.

Sources

Is GHSA-v3rj-xjv7-4jmq in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free