CVE-2025-57820: Devalue Devalue Prototype Pollution Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-vj54-72f3-p5jv
CWE-1321
Published
Advisory Summary

CVE-2025-57820 is a HIGH devalue prototype pollution vulnerability vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Devalue libraries in the npm ecosystem. The issue involves devalue prototype pollution vulnerability. Remediation is available by upgrading affected packages to version 5.3.2.

CVE-2025-57820 at a Glance

CVE Identifier CVE-2025-57820
GHSA Identifier GHSA-vj54-72f3-p5jv
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Devalue
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2025-57820

To remediate this vulnerability, upgrade all affected Devalue dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

devalue fixed: 5.3.2
npm install devalue@5.3.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls devalue

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-57820, inspect your project dependencies using npm:

npm ls devalue

Analyze the terminal output to locate any version of Devalue in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 5.3.2), your application is affected.

Note: The npm ls devalue 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-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Devalue, 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

## 1. `devalue.parse` allows `__proto__` to be set A string passed to `devalue.parse` could represent an object with a `__proto__` property, which would assign a prototype to an object while allowing properties to be overwritten: ```js class Vector { constructor(x, y) { this.x = x; this.y = y; } get magnitude() { return (this.x ** 2 + this.y ** 2) ** 0.5; } } const payload = `[{"x":1,"y":2,"magnitude":3,"__proto__":4},3,4,"nope",["Vector",5],[6,7],8,9]`; const vector = devalue.parse(payload, { Vector: ([x, y]) => new Vector(x, y) }); console.log("Is vector", vector instanceof Vector); // true console.log(vector.x) // 3 console.log(vector.y) // 4 console.log(vector.magnitude); // "nope" instead of 5 ``` ## 2. `devalue.parse` allows array prototype methods to be assigned to object In a payload constructed with `devalue.stringify`, values are represented as array indices, where the array contains the 'hydrated' values: ```js devalue.stringify({ message: 'hello' }); // [{"message":1},"hello"] ``` `devalue.parse` does not check that an index is numeric, which means that it could assign an array prototype method to a property instead: ```js const object = devalue.parse('[{"toString":"push"}]'); object.toString(); // 0 ``` This could be used by a creative attacker to bypass server-side validation.

CVE-2025-57820 Affected Devalue Versions

1 component(s)
Fixed Versions:
5.3.2
Product / Package Ecosystem Affected Versions Fixed Version
devalue
npm
< 5.3.2
5.3.2

References

Frequently Asked Questions

What is CVE-2025-57820?
CVE-2025-57820 is a security vulnerability in Devalue involving devalue prototype pollution vulnerability under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Devalue versions are affected?
Affected versions include releases prior to 5.3.2 across affected packages: devalue.
What version fixes CVE-2025-57820?
Upgrading to 5.3.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is devalue affected?
Yes, devalue is affected in releases prior to 5.3.2. Upgrade your dependency to 5.3.2 or later.
What CWE is associated with CVE-2025-57820?
CVE-2025-57820 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2025-57820?
Run the dependency tree command: 'npm ls devalue'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vj54-72f3-p5jv",
  "modified" : "2025-08-27T14:27:08Z",
  "published" : "2025-08-26T22:33:14Z",
  "aliases" : [ "CVE-2025-57820" ],
  "summary" : "devalue prototype pollution vulnerability",
  "details" : "## 1. `devalue.parse` allows `__proto__` to be set\n\nA string passed to `devalue.parse` could represent an object with a `__proto__` property, which would assign a prototype to an object while allowing properties to be overwritten:\n\n```js\nclass Vector {\n  constructor(x, y) {\n    this.x = x;\n    this.y = y;\n  }\n\n  get magnitude() {\n    return (this.x ** 2 + this.y ** 2) ** 0.5;\n  }\n}\n\nconst payload = `[{\"x\":1,\"y\":2,\"magnitude\":3,\"__proto__\":4},3,4,\"nope\",[\"Vector\",5],[6,7],8,9]`;\n\nconst vector = devalue.parse(payload, {\n  Vector: ([x, y]) => new Vector(x, y)\n});\n\nconsole.log(\"Is vector\", vector instanceof Vector); // true\nconsole.log(vector.x) // 3\nconsole.log(vector.y) // 4\nconsole.log(vector.magnitude); // \"nope\" instead of 5\n```\n\n## 2. `devalue.parse` allows array prototype methods to be assigned to object\n\nIn a payload constructed with `devalue.stringify`, values are represented as array indices, where the array contains the 'hydrated' values:\n\n```js\ndevalue.stringify({ message: 'hello' }); // [{\"message\":1},\"hello\"]\n```\n\n`devalue.parse` does not check that an index is numeric, which means that it could assign an array prototype method to a property instead:\n\n```js\nconst object = devalue.parse('[{\"toString\":\"push\"}]');\nobject.toString(); // 0\n```\n\nThis could be used by a creative attacker to bypass server-side validation.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "devalue"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.3.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/devalue/security/advisories/GHSA-vj54-72f3-p5jv"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-57820"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/sveltejs/devalue/commit/0623a47c9555b639c03ff1baea82951b2d9d1132"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/sveltejs/devalue"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-08-26T22:33:14Z",
    "nvd_published_at" : "2025-08-26T23:15:35Z"
  }
}