PT-2021-8147 · Newtonsoft · Newtonsoft.Json
Gil Mirmovitch
·
Published
2021-01-19
·
Updated
2025-09-10
·
CVE-2024-21907
7.8
High
Base vector | Vector | AV: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
Affected Products
References · 34
- 🔥 https://github.com/JamesNK/Newtonsoft.Json/issues/2457⭐ 10845 🔗 3264 · Exploit
- 🔥 https://alephsecurity.com/vulns/aleph-2018004 · Exploit
- 🔥 https://security.snyk.io/vuln/SNYK-DOTNET-NEWTONSOFTJSON-2774678 · Exploit
- 🔥 https://alephsecurity.com/2018/10/22/StackOverflowException · Exploit
- https://github.com/JamesNK/Newtonsoft.Json/pull/2462⭐ 10845 🔗 3264 · Patch
- https://github.com/JamesNK/Newtonsoft.Json/commit/7e77bbe1beccceac4fc7b174b53abfefac278b66⭐ 10845 🔗 3264 · Patch
- https://bdu.fstec.ru/vul/2024-08967 · Security Note
- https://osv.dev/vulnerability/CVE-2024-21907 · Vendor Advisory
- https://cve.org/CVERecord?id=CVE-2024-21907 · Security Note
- https://ubuntu.com/security/CVE-2024-21907 · Vendor Advisory
- https://osv.dev/vulnerability/GHSA-8rfx-6mr3-5jh3 · Vendor Advisory
- https://nvd.nist.gov/vuln/detail/CVE-2024-21907 · Security Note
- https://osv.dev/vulnerability/UBUNTU-CVE-2024-21907 · Vendor Advisory
- https://osv.dev/vulnerability/GHSA-5crp-9r3c-p9vr · Vendor Advisory
- https://github.com/JamesNK/Newtonsoft.Json⭐ 10844 🔗 3264 · Note