CVE-2025-57820: Svelte devalue vulnerable to prototype pollution

Published Aug 26, 2025
·
Updated

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.

Other sources

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

MITRE

Affected Software

2 affected componentsFixes available
svelte devalue<5.3.2
npm/devalue<5.3.2
5.3.2

Event History

Aug 26, 2025
Advisory Published
via GitHub·10:33 PM
Data Sourced
via GitHub·10:33 PM
DescriptionWeaknessAffected Software
CVE Published
via MITRE·10:33 PM
Data Sourced
via MITRE·10:33 PM
DescriptionWeakness
Data Sourced
via NVD·11:15 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

What is the severity of CVE-2025-57820?

CVE-2025-57820 has been classified as a moderate severity vulnerability.

2

How do I fix CVE-2025-57820?

To fix CVE-2025-57820, upgrade the devalue package to version 5.3.2 or later.

3

What software is affected by CVE-2025-57820?

CVE-2025-57820 affects the Svelte devalue library versions prior to 5.3.2.

4

What type of vulnerability is CVE-2025-57820?

CVE-2025-57820 is a prototype pollution vulnerability that can allow properties to be overwritten.

5

Can I continue using devalue if I have CVE-2025-57820?

Using devalue with CVE-2025-57820 puts your application at risk, and it is recommended to update to the fixed version immediately.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203