High, CVSS 7.5NuGetPublished
Improper Handling of Exceptional Conditions in Newtonsoft.Json
CVE-2024-21907 · GHSA-5crp-9r3c-p9vr
- Affected
- NuGet newtonsoft.json < 13.0.1
- Fixed in
- 13.0.1· Vendor fix available
- Issue
- Newtonsoft.Json prior to version 13.0.1 is vulnerable to Insecure Defaults due to improper handling of expressions with high nesting level that lead to StackOverFlow exception or high CPU and RAM usage. Exploiting this vulnerability results in Denial Of Service (DoS). The serialization and deserialization path have different properties regarding the issue. Deserializing methods (like JsonConvert.DeserializeObject) will process the input that results in burning the CPU, allocating memory, and consuming a thread of execution. Quite high nesting level (10kk, or 9.5MB of {a:{a:{... input) is needed to achieve the latency over 10 seconds, depending on the hardware. Serializing methods (like JsonConvert.Serialize or JObject.ToString) will throw StackOverFlow exception with the nesting level of around 20k. To mitigate the issue one either need to update Newtonsoft.Json to 13.0.1 or set MaxDepth parameter in the JsonSerializerSettings. This can be done globally with the following statement.…
Recommended action: Upgrade to 13.0.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.