Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2021-48012 Overview
CVE-2021-48012 is a prototype pollution vulnerability in the fast-toml Node.js library through version 0.5.4. The library fails to sanitize reserved key segments when parsing Tom's Obvious Minimal Language (TOML) input. Attackers can supply TOML payloads containing __proto__, constructor, or prototype key segments to the parse() function. Successful exploitation modifies Object.prototype globally, polluting every object in the running Node.js process. The flaw is tracked under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes.
Critical Impact
Attackers who control TOML input passed to fast-toml can pollute the global object prototype, causing denial of service or bypassing authorization checks in dependent applications.
Affected Products
- fast-toml npm package, all versions through 0.5.4
- Node.js applications that pass untrusted TOML to fast-toml.parse()
- Downstream libraries and services depending on vulnerable fast-toml releases
Discovery Timeline
- 2026-10-12 - CVE-2021-48012 published to the National Vulnerability Database
- 2026-10-16 - Last updated in NVD database
Technical Details for CVE-2021-48012
Vulnerability Analysis
The fast-toml parser walks TOML table headers and dotted keys to build a JavaScript object tree. The parser assigns child properties without filtering reserved identifiers used by the JavaScript prototype chain. When input contains [__proto__], [constructor.prototype], or dotted keys like __proto__.polluted, the assignment traverses into Object.prototype rather than creating isolated properties. Any property set this way becomes visible on every object in the process. This creates both a denial-of-service primitive and an authorization bypass primitive, depending on how downstream code reads attributes from parsed objects.
Root Cause
The root cause is missing key-name validation during object construction in the parser. fast-toml uses direct property assignment such as obj[key] = value without checking whether key matches __proto__, constructor, or prototype. JavaScript treats these keys specially, redirecting writes to the prototype chain. The fix proposed in the project's Pull Request #3 and discussed in Issue #8 rejects or safely handles these reserved segments.
Attack Vector
Exploitation requires an attacker to deliver TOML content that reaches the vulnerable parse() call. Common attack surfaces include configuration file uploads, API endpoints that accept TOML bodies, and build pipelines that process user-supplied manifests. A payload such as a table header [__proto__] with an attribute like isAdmin = true causes every object in the Node.js process to report isAdmin === true on property lookup. See the VulnCheck advisory for additional payload shapes and the upstream fast-toml repository for parser internals.
Detection Methods for CVE-2021-48012
Indicators of Compromise
- TOML input containing table headers [__proto__], [constructor], [prototype], or nested variants like [constructor.prototype].
- Dotted keys referencing __proto__.<name>, constructor.prototype.<name>, or prototype.<name> in parsed configuration files.
- Unexpected properties appearing on arbitrary JavaScript objects at runtime after TOML ingestion.
- Application logs showing authorization decisions flipping without a corresponding policy change.
Detection Strategies
- Perform software composition analysis to flag fast-toml versions up to and including 0.5.4 in package-lock.json and yarn.lock files.
- Add static analysis rules that match the regex (__proto__|constructor|prototype) inside TOML inputs received over the network.
- Instrument the parse() call site to log keys before assignment, allowing retrospective hunts for reserved identifiers.
- Monitor Node.js processes for anomalous property enumeration on Object.prototype using runtime application self-protection (RASP) hooks.
Monitoring Recommendations
- Forward web application firewall (WAF) and reverse-proxy logs that capture TOML request bodies into a centralized data lake for query.
- Alert on inbound HTTP payloads with Content-Type: application/toml containing the strings __proto__, constructor, or prototype.
- Track npm dependency drift continuously so new installations of vulnerable fast-toml builds are surfaced within a build cycle.
How to Mitigate CVE-2021-48012
Immediate Actions Required
- Inventory all Node.js services and locate any direct or transitive dependency on fast-toml at version 0.5.4 or earlier.
- Replace fast-toml with a maintained TOML parser that rejects prototype-polluting keys, or apply the patch from Pull Request #3.
- Validate TOML input at the application boundary and reject payloads containing __proto__, constructor, or prototype segments before parsing.
- Freeze critical objects with Object.freeze(Object.prototype) during application startup to reduce blast radius.
Patch Information
No fixed release of fast-toml has been published on npm at the time of CVE assignment. The project is tracked on GitHub, where Issue #8 documents the vulnerability and Pull Request #3 proposes a parser fix. Teams unable to migrate should vendor the patched parser locally or switch to an actively maintained TOML library.
Workarounds
- Sanitize input strings and reject TOML containing __proto__, constructor, or prototype keys before invoking parse().
- Use Object.create(null) for parsed result containers so the output does not inherit from Object.prototype.
- Call Object.freeze(Object.prototype) early in application bootstrap to prevent runtime pollution of the global prototype.
- Restrict the attack surface by refusing TOML input from untrusted sources and enforcing allow-lists on configuration schemas.
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

