CVE-2024-21907
Improper Handling of Exceptional Conditions in Newtonsoft.Json
Newtonsoft.Json before version 13.0.1 is affected by a mishandling of exceptional conditions vulnerability. Crafted data that is passed to the JsonConvert.DeserializeObject method may trigger a StackOverflow exception resulting in denial of service. Depending on the usage of the library, an unauthenticated and remote attacker may be able to cause the denial of service condition.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
7.5
Newtonsoft.Json before version 13.0.1 is affected by a mishandling of exceptional conditions vulnerability. Crafted data that is passed to the JsonConvert.DeserializeObject method may trigger a StackOverflow exception resulting in denial of service. Depending on the usage of the library, an unauthenticated and remote attacker may be able to cause the denial of service condition.
- Record
CVE-2024-21907- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-755
- Updated
- 2026-11-02
CVE List
7.5
Improper Handling of Exceptional Conditions in Newtonsoft.Json
Newtonsoft.Json before version 13.0.1 is affected by a mishandling of exceptional conditions vulnerability. Crafted data that is passed to the JsonConvert.DeserializeObject method may trigger a StackOverflow exception resulting in denial of service. Depending on the usage of the library, an unauthenticated and remote attacker may be able to cause the denial of service condition.
- Record
CVE-2024-21907- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-755
- Updated
- 2026-11-08
EUVDEUVD-2022-5935
7.5
Newtonsoft.Json before version 13.0.1 is affected by a mishandling of exceptional conditions vulnerability. Crafted data that is passed to the JsonConvert.DeserializeObject method may trigger a StackOverflow exception resulting in denial of service. Depending on the usage of the library, an unauthenticated and remote attacker may be able to cause the denial of service condition.
- Record
EUVD-2022-5935- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-08
GitHub AdvisoriesGHSA-5crp-9r3c-p9vr
7.5
Improper Handling of Exceptional Conditions in Newtonsoft.Json
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. After that the parsing of the nested input will fail fast with Newtonsoft.Json.JsonReaderException:
JsonConvert.DefaultSettings = () => new JsonSerializerSettings { MaxDepth = 128 };
Repro code:
//Create a string representation of an highly nested object (JSON serialized)
int nRep = 25000;
string json = string.Concat(Enumerable.Repeat("{a:", nRep)) + "1" +
string.Concat(Enumerable.Repeat("}", nRep));
//Parse this object (leads to high CPU/RAM consumption)
var parsedJson = JsonConvert.DeserializeObject(json);
// Methods below all throw stack overflow with nRep around 20k and higher
// string a = parsedJson.ToString();
// string b = JsonConvert.SerializeObject(parsedJson);
Additional affected product and version information
The original statement about the problem only affecting IIS applications is misleading. Any application is affected, however the IIS has a behavior that stops restarting the instance after some time resulting in a harder-to-fix DoS.**
- Record
GHSA-5crp-9r3c-p9vr- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-755
- Updated
- 2026-11-02
OSV
7.5
Improper Handling of Exceptional Conditions in Newtonsoft.Json
Newtonsoft.Json before version 13.0.1 is affected by a mishandling of exceptional conditions vulnerability. Crafted data that is passed to the JsonConvert.DeserializeObject method may trigger a StackOverflow exception resulting in denial of service. Depending on the usage of the library, an unauthenticated and remote attacker may be able to cause the denial of service condition.
- Record
CVE-2024-21907- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-755
- Updated
- 2026-11-09
OSVGHSA-5crp-9r3c-p9vr
7.5
Improper Handling of Exceptional Conditions in Newtonsoft.Json
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. After that the parsing of the nested input will fail fast with Newtonsoft.Json.JsonReaderException:
JsonConvert.DefaultSettings = () => new JsonSerializerSettings { MaxDepth = 128 };
Repro code:
//Create a string representation of an highly nested object (JSON serialized)
int nRep = 25000;
string json = string.Concat(Enumerable.Repeat("{a:", nRep)) + "1" +
string.Concat(Enumerable.Repeat("}", nRep));
//Parse this object (leads to high CPU/RAM consumption)
var parsedJson = JsonConvert.DeserializeObject(json);
// Methods below all throw stack overflow with nRep around 20k and higher
// string a = parsedJson.ToString();
// string b = JsonConvert.SerializeObject(parsedJson);
Additional affected product and version information
The original statement about the problem only affecting IIS applications is misleading. Any application is affected, however the IIS has a behavior that stops restarting the instance after some time resulting in a harder-to-fix DoS.**
- Record
GHSA-5crp-9r3c-p9vr- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-755
- Updated
- 2026-11-02
OSVUBUNTU-CVE-2024-21907
7.5
Newtonsoft.Json before version 13.0.1 is affected by a mishandling of exceptional conditions vulnerability. Crafted data that is passed to the JsonConvert.DeserializeObject method may trigger a StackOverflow exception resulting in denial of service. Depending on the usage of the library, an unauthenticated and remote attacker may be able to cause the denial of service condition.
- Record
UBUNTU-CVE-2024-21907- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
Newtonsoft.JsonNuGet |
before 13.0.1 | 13.0.1 |
Newtonsoft.JsonNuGet |
before 13.0.1, plus listed versions 10.0.110.0.1-beta110.0.210.0.311.0.1 Show 45 moreShow less11.0.1-beta111.0.1-beta211.0.1-beta311.0.212.0.112.0.1-beta112.0.1-beta212.0.212.0.2-beta112.0.2-beta212.0.2-beta312.0.312.0.3-beta112.0.3-beta213.0.1-beta113.0.1-beta23.5.84.0.14.0.24.0.34.0.44.0.54.0.64.0.74.0.84.5.14.5.104.5.114.5.24.5.34.5.44.5.54.5.64.5.74.5.84.5.95.0.15.0.25.0.35.0.45.0.55.0.65.0.75.0.86.0.1 |
13.0.1 |
newtonsoft-jsonUbuntu:16.04:LTS |
All versions, plus listed versions 5.0r6+dfsg-15.0r6+dfsg-1ubuntu16.0.8+dfsg-1 |
None known |
newtonsoft-jsonUbuntu:18.04:LTS |
All versions, plus listed versions 6.0.8+dfsg-1 |
None known |
newtonsoft-jsonUbuntu:20.04:LTS |
All versions, plus listed versions 6.0.8+dfsg-1 |
None known |
newtonsoft-jsonUbuntu:22.04:LTS |
All versions, plus listed versions 6.0.8+dfsg-1.1 |
None known |
newtonsoft-jsonUbuntu:24.04:LTS |
All versions, plus listed versions 6.0.8+dfsg-1.16.0.8+dfsg-1.2 |
None known |
Public exploits
Links only. Every CVE stores no exploit code.
| Source | Link | Date |
|---|---|---|
| PoC in GitHub | iSecurityTW/seal-security-nuget-demo-net7 | 2026-05-18 |
History
| Recorded | Changed | Sources |
|---|---|---|
| references | EUVD, OSV | |
| facts, references | CVE List | |
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV, PoC in GitHub |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2024-21907 is a high vulnerability (CVSS 7.5) in Newtonsoft Json.net, published June 22, 2022. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 32.9%, the 98th percentile. Fixed in Newtonsoft.Json 13.0.1.
References
github.com/JamesNK/Newtonsoft.Json/issues/2457
github.com/JamesNK/Newtonsoft.Json/pull/2462
github.com/JamesNK/Newtonsoft.Json/commit/7e77bbe1beccceac4fc7b174b53abfefac278b66
alephsecurity.com/2018/10/22/StackOverflowException
alephsecurity.com/vulns/aleph-2018004
security.snyk.io/vuln/SNYK-DOTNET-NEWTONSOFTJSON-2774678
Show 8 moreShow less
github.com/advisories/GHSA-5crp-9r3c-p9vr
vulncheck.com/advisories/vc-advisory-GHSA-5crp-9r3c-p9vr
nuget.org/packages
github.com/CVEProject/cvelistV5/tree/main/cves/2024/21xxx/CVE-2024-21907.json
nvd.nist.gov/vuln/detail/CVE-2024-21907
github.com/JamesNK/Newtonsoft.Json
ubuntu.com/security/CVE-2024-21907
cve.org/CVERecord?id=CVE-2024-21907
Left out here: 24 versions. The JSON record has them.