Skip to main content
EPSS 0.2%top 86%

CVE-2026-50029: CWE-697: Incorrect Comparison in sunnyadn js-toml

0
Medium
Published: 08/14/2026 (08/14/2026, 19:08:54 UTC)
Source: GCVE Database
Vendor/Project: sunnyadn
Product: js-toml

Description

js-toml is a TOML parser for JavaScript, Prior to version 1.1.2, the interpreter checks whether a key already exists in a parser-built container with `if (object[key])` instead of `if (key in object)`. When the prior value is a falsy primitive — `false`, `0`, `0n`, `0.0`, `-0`, or `""` — the duplicate-key branch is skipped and the value is silently overwritten by a later sub-table, dotted-key sub-table, or array-of-tables sharing the same name. Per the TOML 1.0.0 spec ("Defining a key multiple times is invalid"; "You cannot define any key or table more than once"), this should be a parse error. The result is structural type confusion of attacker-named keys in the value returned by `load()`. A boolean-typed `false` (or numeric `0`) becomes a truthy object. Host applications that gate behavior on `if (config.flag)`, `if (!user.banned)`, `if (config.allowDelete)`, or `if (config.publicMode)` will silently take the truthy branch. This is distinct from GHSA-65fc-cr5f-v7r2 (the 1.0.2 prototype-pollution fix). `Object.prototype` is not polluted. The `Object.create(null)` mitigation from 1.0.2 is intact; the bug here is in the duplicate-key state machine, not in container construction. Version 1.1.2 patches the incorrect comparison.

CVSS v3.1

Score 5.3medium

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

Affected software

npmghsa
js-toml
Affected versions
<1.1.2

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/23/2026, 11:19:09 UTC

Technical Analysis

The js-toml JavaScript TOML parser before version 1.1.2 uses an incorrect comparison (`if (object[key])`) to detect duplicate keys instead of the correct `if (key in object)`. This causes keys with falsy primitive values (false, 0, 0n, 0.0, -0, or empty string) to be treated as non-existent, allowing later sub-tables or arrays with the same key to overwrite them silently. According to the TOML 1.0.0 specification, defining a key multiple times is invalid and should result in a parse error. The flaw leads to structural type confusion where a boolean false or numeric zero is replaced by a truthy object, potentially causing host applications to incorrectly take truthy branches in conditional logic. This vulnerability is distinct from a prior prototype pollution fix and does not involve Object.prototype pollution. The issue is fixed in version 1.1.2 by correcting the duplicate-key detection logic.

Potential Impact

This vulnerability can cause silent overwriting of configuration keys with falsy values, leading to structural type confusion in the parsed configuration object. Applications that rely on boolean checks of these keys may behave incorrectly, potentially enabling unintended code paths or logic errors. There is no impact on confidentiality or availability, and no prototype pollution occurs. The CVSS score is 5.3 (medium severity), reflecting limited impact on integrity without elevation of privileges or denial of service.

Mitigation Recommendations

Upgrade to js-toml version 1.1.2 or later, which corrects the duplicate-key detection logic and enforces the TOML specification by generating parse errors on duplicate keys. Patch status is confirmed by the vendor advisory indicating the fix is in version 1.1.2. No other mitigations are required.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-m34p-749j-x6m6
Osv Schema Version
1.4.0
Aliases
["CVE-2026-50029"]
Ecosystems
["npm"]
Database Specific Severity
MODERATE
Cvss Version
3.1

Threat ID: 6a5fcf4e1010f89cc21536cb

Added to database: 07/21/2026, 19:58:06 UTC

Last enriched: 08/23/2026, 11:19:09 UTC

Last updated: 09/12/2026, 22:01:34 UTC

Views: 41

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses