Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-32014

CVE-2025-32014: estree-util-value-to-estree Vulnerability

CVE-2025-32014 affects estree-util-value-to-estree when converting JavaScript values with __proto__ properties to ESTree expressions. This article covers the technical details, affected versions, and mitigation steps.

Published:

CVE-2025-32014 Overview

CVE-2025-32014 affects estree-util-value-to-estree, a JavaScript library that converts values to ESTree expressions. The library mishandles input objects that contain a __proto__ property. Instead of emitting a regular property, valueToEstree generates an object literal that sets the prototype of the produced object. This behavior leads to prototype pollution [CWE-1321] in code that consumes the generated AST. Maintainers addressed the flaw in version 3.3.3.

Critical Impact

Attacker-controlled values processed by valueToEstree can inject a prototype chain into generated ESTree output, altering downstream object behavior and enabling prototype pollution in build pipelines and code generators.

Affected Products

  • estree-util-value-to-estree versions prior to 3.3.3
  • Node.js build tooling and MDX pipelines that consume this library
  • Any downstream package that serializes untrusted values into ESTree output

Discovery Timeline

  • 2025-04-07 - CVE-2025-32014 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-32014

Vulnerability Analysis

The estree-util-value-to-estree package converts arbitrary JavaScript values into ESTree AST nodes. Consumers use it to embed literal data inside generated JavaScript source, commonly during MDX compilation and other code-generation workflows.

When the input value contains a property literally named __proto__, the previous implementation emitted the property in a way that the JavaScript runtime interprets as a prototype assignment rather than an own property. The resulting ESTree, when serialized and evaluated, mutates the prototype chain of the produced object.

An attacker who controls values passed to valueToEstree can therefore inject a prototype into generated code. The generated module then propagates polluted objects to any consumer that reads properties from them, which can alter application logic, bypass checks, or trigger downstream vulnerabilities.

Root Cause

The root cause is improper handling of the special __proto__ key during AST construction, mapped to [CWE-1321] (Improperly Controlled Modification of Object Prototype Attributes). The library emitted __proto__ as an ordinary object property key, which JavaScript treats as a prototype directive in object literal syntax rather than a computed own property.

Attack Vector

An attacker supplies a JavaScript value containing a __proto__ key to any consumer that forwards it into valueToEstree. This typically occurs in server-side rendering, MDX front matter processing, or build-time content transforms that trust remote data. The generated code is then executed, poisoning the prototype chain of the produced object.

javascript
// Fix demonstrated in fixtures/object-proto-property/input.js
// Used as input
// { preserveReferences: true }
export default {
  ['__proto__']: {}
}

// -------------------------------------------------------------------------------------------------

// Default output
// { preserveReferences: false }
const withoutPreserveReferences = {
  ['__proto__']: {}
}

Source: GitHub Commit d0c394f

The patch emits __proto__ using a computed key ['__proto__'], which JavaScript treats as an own property rather than a prototype directive. When callers set preserveReferences: true and the value is recursive, the fix additionally uses Object.defineProperties to attach the property safely:

javascript
// Fix demonstrated in fixtures/object-proto-property-recursive/input.js
export default ((
  $1 = {
    name: '$1'
  },
  $0 = {
    ['__proto__']: $1,
    name: '$0'
  }
) => (
  Object.defineProperties($1, {
    ['__proto__']: {
      value: $0,
      configurable: true,
      enumerable: true,
      writable: true
    }
  }),
  $0
))()

Source: GitHub Commit d0c394f

Detection Methods for CVE-2025-32014

Indicators of Compromise

  • Generated JavaScript modules containing bare __proto__: keys inside object literals produced by the affected library.
  • Application errors or logic anomalies referencing properties inherited from unexpected prototypes.
  • Untrusted content sources (MDX, JSON, API responses) containing a __proto__ key that reach build-time serialization.

Detection Strategies

  • Enumerate dependency trees with npm ls estree-util-value-to-estree to identify versions prior to 3.3.3.
  • Scan build output for object literals containing a literal __proto__ key rather than the safe computed form ['__proto__'].
  • Add unit tests that pass objects with a __proto__ property through content pipelines and assert that the resulting object's prototype is unchanged.

Monitoring Recommendations

  • Monitor CI/CD build logs for warnings from linters or SAST tools that flag prototype pollution patterns.
  • Track Software Composition Analysis (SCA) alerts referencing GHSA-f7f6-9jq7-3rqj across repositories.
  • Alert on runtime exceptions in Node.js services that indicate unexpected inherited properties on plain objects.

How to Mitigate CVE-2025-32014

Immediate Actions Required

  • Upgrade estree-util-value-to-estree to version 3.3.3 or later across all direct and transitive dependencies.
  • Rebuild and redeploy any artifacts previously produced with a vulnerable version.
  • Audit content sources that feed the library and reject or sanitize objects containing a __proto__ key.

Patch Information

The fix is available in estree-util-value-to-estree version 3.3.3. Review the GitHub Security Advisory GHSA-f7f6-9jq7-3rqj and the remediation commit d0c394f for details.

Workarounds

  • Strip or reject __proto__ keys from untrusted input before passing values to valueToEstree.
  • Freeze Object.prototype at application startup using Object.freeze(Object.prototype) to blunt downstream pollution impact.
  • Isolate build steps that use the vulnerable library so that generated code cannot influence privileged runtime paths.
bash
# Upgrade the vulnerable package to the fixed release
npm install estree-util-value-to-estree@^3.3.3

# Verify the resolved version across the dependency tree
npm ls estree-util-value-to-estree

# Audit remaining advisories
npm audit --production

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.