{"id":"CVE-2024-21907","aliases":["EUVD-2022-5935","GHSA-5crp-9r3c-p9vr","UBUNTU-CVE-2024-21907"],"status":"published","title":"Improper Handling of Exceptional Conditions in Newtonsoft.Json","description":"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.","severity":{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-09","score":0.32908,"percentile":0.98366,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":true,"fix_available":true},"cwes":["CWE-755"],"published":"2022-06-22T15:08:47Z","modified":"2026-11-09T02:45:45Z","exploits":[{"source":"pocgithub","id":"iSecurityTW/seal-security-nuget-demo-net7","title":"iSecurityTW/seal-security-nuget-demo-net7","date":"2026-05-18","url":"https://github.com/iSecurityTW/seal-security-nuget-demo-net7"}],"fixes":[{"ecosystem":"NuGet","package":"Newtonsoft.Json","fixed_in":["13.0.1"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"NuGet","package":"Newtonsoft.Json","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"13.0.1"}]}]},{"source":"osv","ecosystem":"NuGet","package":"Newtonsoft.Json","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"13.0.1"}]}],"versions":["10.0.1","10.0.1-beta1","10.0.2","10.0.3","11.0.1","11.0.1-beta1","11.0.1-beta2","11.0.1-beta3","11.0.2","12.0.1","12.0.1-beta1","12.0.1-beta2","12.0.2","12.0.2-beta1","12.0.2-beta2","12.0.2-beta3","12.0.3","12.0.3-beta1","12.0.3-beta2","13.0.1-beta1","13.0.1-beta2","3.5.8","4.0.1","4.0.2","4.0.3","4.0.4","4.0.5","4.0.6","4.0.7","4.0.8","4.5.1","4.5.10","4.5.11","4.5.2","4.5.3","4.5.4","4.5.5","4.5.6","4.5.7","4.5.8","4.5.9","5.0.1","5.0.2","5.0.3","5.0.4","5.0.5","5.0.6","5.0.7","5.0.8","6.0.1","6.0.1-beta1","6.0.2","6.0.3","6.0.4","6.0.5","6.0.6","6.0.7","6.0.8","7.0.1","7.0.1-beta1","7.0.1-beta2","7.0.1-beta3","8.0.1","8.0.1-beta1","8.0.1-beta2","8.0.1-beta3","8.0.1-beta4","8.0.2","8.0.3","8.0.4-beta1","9.0.1","9.0.1-beta1","9.0.2-beta1","9.0.2-beta2"]},{"source":"osv","ecosystem":"Ubuntu:16.04:LTS","package":"newtonsoft-json","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["5.0r6+dfsg-1","5.0r6+dfsg-1ubuntu1","6.0.8+dfsg-1"]},{"source":"osv","ecosystem":"Ubuntu:18.04:LTS","package":"newtonsoft-json","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.8+dfsg-1"]},{"source":"osv","ecosystem":"Ubuntu:20.04:LTS","package":"newtonsoft-json","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.8+dfsg-1"]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"newtonsoft-json","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.8+dfsg-1.1"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"newtonsoft-json","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["6.0.8+dfsg-1.1","6.0.8+dfsg-1.2"]}],"products":[{"vendor":"newtonsoft","product":"json.net"}],"references":[{"url":"https://github.com/JamesNK/Newtonsoft.Json/issues/2457","tags":["issue-tracking","x_transferred","Exploit","Issue Tracking","Third Party Advisory","report","web"]},{"url":"https://github.com/JamesNK/Newtonsoft.Json/pull/2462","tags":["issue-tracking","patch","related","x_transferred","Patch","fix","web","report"]},{"url":"https://github.com/JamesNK/Newtonsoft.Json/commit/7e77bbe1beccceac4fc7b174b53abfefac278b66","tags":["patch","related","x_transferred","Patch","fix","web","report"]},{"url":"https://alephsecurity.com/2018/10/22/StackOverflowException/","tags":["related","x_transferred","Exploit","web","report"]},{"url":"https://alephsecurity.com/vulns/aleph-2018004","tags":["related","x_transferred","Exploit","web","report"]},{"url":"https://security.snyk.io/vuln/SNYK-DOTNET-NEWTONSOFTJSON-2774678","tags":["related","x_transferred","Exploit","Third Party Advisory","web","report"]},{"url":"https://github.com/advisories/GHSA-5crp-9r3c-p9vr","tags":["vendor-advisory","third-party-advisory","x_transferred","Third Party Advisory","advisory","report"]},{"url":"https://vulncheck.com/advisories/vc-advisory-GHSA-5crp-9r3c-p9vr","tags":["third-party-advisory","x_transferred","Third Party Advisory","advisory","report"]},{"url":"https://nuget.org/packages","tags":["web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/21xxx/CVE-2024-21907.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-21907","tags":["advisory"]},{"url":"https://alephsecurity.com/2018/10/22/StackOverflowException","tags":["web"]},{"url":"https://github.com/JamesNK/Newtonsoft.Json","tags":["package"]},{"url":"https://ubuntu.com/security/CVE-2024-21907","tags":["report"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2024-21907","tags":["report"]}],"sources":{"cve":[{"id":"CVE-2024-21907","title":"Improper Handling of Exceptional Conditions in Newtonsoft.Json","description":"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.","status":"published","published":"2024-01-03T15:23:04.441Z","modified":"2026-11-08T13:59:50.15Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"adp"}],"cwes":["CWE-755"],"updated_at":"2026-11-08T14:43:22.764053Z"}],"euvd":[{"id":"EUVD-2022-5935","description":"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.","status":"published","published":"2024-01-03T15:23:04Z","modified":"2026-11-08T13:59:50Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"updated_at":"2026-11-08T15:13:10.25084Z"}],"ghsa":[{"id":"GHSA-5crp-9r3c-p9vr","title":"Improper Handling of Exceptional Conditions in Newtonsoft.Json","description":"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). \n\nThe serialization and deserialization path have different properties regarding the issue.\n\nDeserializing 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 (\u003e10kk, or 9.5MB of `{a:{a:{...` input) is needed to achieve the latency over 10 seconds, depending on the hardware.\n\nSerializing methods (like `JsonConvert.Serialize` or `JObject.ToString`) will throw StackOverFlow exception with the nesting level of around 20k.\n\nTo 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`:\n\n``` \nJsonConvert.DefaultSettings = () =\u003e new JsonSerializerSettings { MaxDepth = 128 };\n```\n\nRepro code:\n```\n//Create a string representation of an highly nested object (JSON serialized)\nint nRep = 25000;\nstring json = string.Concat(Enumerable.Repeat(\"{a:\", nRep)) + \"1\" +\n string.Concat(Enumerable.Repeat(\"}\", nRep));\n\n//Parse this object (leads to high CPU/RAM consumption)\nvar parsedJson = JsonConvert.DeserializeObject(json);\n\n// Methods below all throw stack overflow with nRep around 20k and higher\n// string a = parsedJson.ToString();\n// string b = JsonConvert.SerializeObject(parsedJson);\n```\n\n### Additional affected product and version information\n**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.**","status":"published","published":"2022-06-22T15:08:47Z","modified":"2024-01-03T20:06:37Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-755"],"updated_at":"2026-11-02T14:37:28.753349Z"}],"nvd":[{"id":"CVE-2024-21907","description":"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.","status":"published","published":"2024-01-03T16:15:08.793Z","modified":"2026-07-14T23:17:13.903Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"primary"},{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high","assessor":"secondary"}],"cwes":["CWE-755"],"updated_at":"2026-11-02T14:09:30.070039Z"}],"osv":[{"id":"CVE-2024-21907","title":"Improper Handling of Exceptional Conditions in Newtonsoft.Json","description":"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.","status":"published","published":"2024-01-03T15:23:04.441Z","modified":"2026-11-09T02:45:45.502938032Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-755"],"updated_at":"2026-11-09T03:16:26.778234Z"},{"id":"GHSA-5crp-9r3c-p9vr","title":"Improper Handling of Exceptional Conditions in Newtonsoft.Json","description":"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). \n\nThe serialization and deserialization path have different properties regarding the issue.\n\nDeserializing 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 (\u003e10kk, or 9.5MB of `{a:{a:{...` input) is needed to achieve the latency over 10 seconds, depending on the hardware.\n\nSerializing methods (like `JsonConvert.Serialize` or `JObject.ToString`) will throw StackOverFlow exception with the nesting level of around 20k.\n\nTo 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`:\n\n``` \nJsonConvert.DefaultSettings = () =\u003e new JsonSerializerSettings { MaxDepth = 128 };\n```\n\nRepro code:\n```\n//Create a string representation of an highly nested object (JSON serialized)\nint nRep = 25000;\nstring json = string.Concat(Enumerable.Repeat(\"{a:\", nRep)) + \"1\" +\n string.Concat(Enumerable.Repeat(\"}\", nRep));\n\n//Parse this object (leads to high CPU/RAM consumption)\nvar parsedJson = JsonConvert.DeserializeObject(json);\n\n// Methods below all throw stack overflow with nRep around 20k and higher\n// string a = parsedJson.ToString();\n// string b = JsonConvert.SerializeObject(parsedJson);\n```\n\n### Additional affected product and version information\n**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.**","status":"published","published":"2022-06-22T15:08:47Z","modified":"2026-07-08T06:53:11.583483075Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"cwes":["CWE-755"],"updated_at":"2026-11-02T15:46:38.213481Z"},{"id":"UBUNTU-CVE-2024-21907","description":"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.","status":"published","published":"2024-01-03T16:15:00Z","modified":"2026-04-22T14:39:31.785076Z","cvss":[{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"},{"version":"3.1","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","level":"high"}],"updated_at":"2026-11-02T16:54:42.68848Z"}]}}
