PT-2021-8147 · Newtonsoft · Newtonsoft.Json

Gil Mirmovitch

·

Published

2021-01-19

·

Updated

2025-09-10

·

CVE-2024-21907

CVSS v2.0
7.8
VectorAV:N/AC:L/Au:N/C:N/I:N/A:C

**Name of the Vulnerable Software and Affected Versions:**

Newtonsoft.Json versions prior to 13.0.1

**Description:**

Newtonsoft.Json is susceptible to a mishandling of exceptional conditions vulnerability. Crafted data provided to the `JsonConvert.DeserializeObject` method can trigger a StackOverflow exception, leading to a denial of service. An unauthenticated, remote attacker may be able to exploit this condition. The vulnerability arises from improper handling of expressions with high nesting levels during deserialization and serialization, potentially causing high CPU and RAM usage or StackOverflow exceptions.

**Recommendations:**

Update Newtonsoft.Json to version 13.0.1 or later.

As a mitigation, set the `MaxDepth` parameter in the `JsonSerializerSettings` to limit the nesting level. This can be applied globally using: `JsonConvert.DefaultSettings = () => new JsonSerializerSettings { MaxDepth = 128 };`.

Exploit

Fix

Improper Handling of Exceptional Conditions

Weakness Enumeration

Related Identifiers

BDU:2024-08967
CVE-2024-21907
GHSA-5CRP-9R3C-P9VR
GHSA-8RFX-6MR3-5JH3

Affected Products

Newtonsoft.Json