7.9high
Svelte devalue vulnerable to prototype pollution
- Severity
- 7.9high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.42% (higher than 38% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-vj54-72f3-p5jv
Description
Svelte devalue is a utility library. Prior to version 5.3.2, a string passed to devalue.parse could represent an object with a __proto__ property and devalue.parse does not check that an index is numeric. This could result in assigning prototypes to objects and properties, leading to prototype pollution. This issue has been fixed in version 5.3.2
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| sveltejs devalue | < 5.3.2 | CVE List |
| devalue (npm) | before 5.3.2 | GitHub Advisory Database |
All scores
| GitHub_M | 7.9high CVSS:4.0 | 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 |
| GitHub | high CVSS:4.0 | 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 |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
Svelte devalue is a utility library. Prior to version 5.3.2, a string passed to devalue.parse could represent an object with a __proto__ property and devalue.parse does not check that an index is numeric. This could result in assigning prototypes to objects and properties, leading to prototype pollution. This issue has been fixed in version 5.3.2
GitHub Advisory Database
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:
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:
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:
const object = devalue.parse('[{"toString":"push"}]');
object.toString(); // 0
This could be used by a creative attacker to bypass server-side validation.
NVD (es)
Svelte devalue es una librería de utilidades. Antes de la versión 5.3.2, una cadena pasada a devalue.parse podía representar un objeto con una propiedad __proto__ y devalue.parse no verificaba si un índice era numérico. Esto podía provocar la asignación de prototipos a objetos y propiedades, lo que generaba contaminación de prototipos. Este problema se ha corregido en la versión 5.3.2.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-57820 changed 2025-08-27 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-vj54-72f3-p5jv changed 2025-08-27 | CC-BY-4.0 |
| NVD | CVE-2025-57820 changed 2026-06-17 | Public domain |