GHSA-pqhp-25j4-6hq9: Smol toml Denial of Service Vulnerability
MODERATEGHSA-pqhp-25j4-6hq9 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-674: Uncontrolled Recursion) affecting Smol toml libraries in the npm ecosystem. The issue involves smol-toml has a denial of service via malicious toml document using deeply nested inline tables. Remediation is available by upgrading affected packages to version 1.3.1.
GHSA-pqhp-25j4-6hq9 at a Glance
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).
How to Fix GHSA-pqhp-25j4-6hq9
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.
npm install smol-toml@1.3.1
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-pqhp-25j4-6hq9, 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.3.1), 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-674: Uncontrolled Recursion, where the product does not properly control the amount of recursion that takes place, consuming excessive resources, such as allocated memory or the program stack. 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
GHSA-pqhp-25j4-6hq9 Affected Smol toml Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
smol-toml
|
npm |
< 1.3.1
|
1.3.1
|
References
Frequently Asked Questions
What is GHSA-pqhp-25j4-6hq9?
Which Smol toml versions are affected?
What version fixes GHSA-pqhp-25j4-6hq9?
Is smol-toml affected?
What is the CVSS score of GHSA-pqhp-25j4-6hq9?
What CWE is associated with GHSA-pqhp-25j4-6hq9?
How can I check npm dependencies for GHSA-pqhp-25j4-6hq9?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-pqhp-25j4-6hq9",
"modified" : "2024-11-22T20:40:49Z",
"published" : "2024-11-22T20:40:49Z",
"aliases" : [ ],
"summary" : "smol-toml has a Denial of Service via malicious TOML document using deeply nested inline tables",
"details" : "### Summary\nAn 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.\n\nThe library does not limit the maximum exploration depth while parsing or producing TOML documents, nor does it offer a way to do so.\n\n### Proof of concept\n```js\nrequire(\"smol-toml\").parse(\"e=\" + \"{e=\".repeat(9999) + \"{}\" + \"}\".repeat(9999))\n```\n\n### Impact\nApplications 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.\n\nDue to the design of most JavaScript runtimes, the uncontrolled recursion does not lead to excessive memory usage and the execution is quickly aborted.\n\nAs a reminder, it is **strongly** advised when working with untrusted user input to expect errors to occur and to appropriately catch them.\n\n### Patches\nVersion 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.\n\n**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.\n\n### Workarounds\nWrap all invocations of `parse` and `stringify` in a try/catch block.",
"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.3.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 1.3.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/squirrelchat/smol-toml/security/advisories/GHSA-pqhp-25j4-6hq9"
}, {
"type" : "WEB",
"url" : "https://github.com/squirrelchat/smol-toml/commit/405108ba090f0fc78f99aa2f0d6721e499b0ff27"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/squirrelchat/smol-toml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-674" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2024-11-22T20:40:49Z",
"nvd_published_at" : null
}
}