artkamote / examples

Serverless Examples – A collection of boilerplates and examples of serverless architectures built with the Serverless Framework on AWS Lambda, Microsoft Azure, Google Cloud Functions, and more.
https://www.serverless.com/examples/
Other
0 stars 0 forks source link

WS-2022-0161 (High) detected in multiple libraries - autoclosed #296

Closed mend-bolt-for-github[bot] closed 4 months ago

mend-bolt-for-github[bot] commented 1 year ago

WS-2022-0161 - High Severity Vulnerability

Vulnerable Libraries - newtonsoft.json.11.0.2.nupkg, Newtonsoft.Json-11.0.2.21924.dll, newtonsoft.json.11.0.1.nupkg, Newtonsoft.Json-12.0.3.23909.dll

newtonsoft.json.11.0.2.nupkg

Json.NET is a popular high-performance JSON framework for .NET

Library home page: https://api.nuget.org/packages/newtonsoft.json.11.0.2.nupkg

Path to dependency file: /aws-dotnet-rest-api-with-dynamodb/src/DotNetServerless.Lambda/DotNetServerless.Lambda.csproj

Path to vulnerable library: /usr/share/dotnet/sdk/NuGetFallbackFolder/newtonsoft.json/11.0.2/newtonsoft.json.11.0.2.nupkg

Dependency Hierarchy: - microsoft.extensions.configuration.json.2.1.1.nupkg (Root Library) - :x: **newtonsoft.json.11.0.2.nupkg** (Vulnerable Library)

Newtonsoft.Json-11.0.2.21924.dll

Json.NET .NET Standard 2.0

Library home page: https://api.nuget.org/packages/newtonsoft.json.11.0.2.nupkg

Path to vulnerable library: /azure-node-typescript-servicebus-trigger-endpoint/node_modules/azure-functions-core-tools/bin/Newtonsoft.Json.dll

Dependency Hierarchy: - :x: **Newtonsoft.Json-11.0.2.21924.dll** (Vulnerable Library)

newtonsoft.json.11.0.1.nupkg

Json.NET is a popular high-performance JSON framework for .NET

Library home page: https://api.nuget.org/packages/newtonsoft.json.11.0.1.nupkg

Path to dependency file: /aws-dotnet-rest-api-with-dynamodb/src/DotNetServerless.Application/DotNetServerless.Application.csproj

Path to vulnerable library: /uget/packages/newtonsoft.json/11.0.1/newtonsoft.json.11.0.1.nupkg

Dependency Hierarchy: - :x: **newtonsoft.json.11.0.1.nupkg** (Vulnerable Library)

Newtonsoft.Json-12.0.3.23909.dll

Json.NET .NET Standard 2.0

Library home page: https://api.nuget.org/packages/newtonsoft.json.12.0.3.nupkg

Path to vulnerable library: /azure-node-line-bot/node_modules/azure-functions-core-tools/bin/Newtonsoft.Json.dll,/azure-node-typescript-servicebus-trigger-endpoint/node_modules/serverless-azure-functions/node_modules/azure-functions-core-tools/bin/workers/powershell/6/Newtonsoft.Json.dll,/azure-node-telegram-bot/node_modules/azure-functions-core-tools/bin/Newtonsoft.Json.dll,/azure-node-typescript-servicebus-trigger-endpoint/node_modules/azure-functions-core-tools/bin/workers/powershell/Newtonsoft.Json.dll,/azure-node-telegram-bot/node_modules/azure-functions-core-tools/bin/workers/powershell/7/Newtonsoft.Json.dll,/azure-node-line-bot/node_modules/azure-functions-core-tools/bin/workers/powershell/7/Newtonsoft.Json.dll,/azure-node-typescript-servicebus-trigger-endpoint/node_modules/serverless-azure-functions/node_modules/azure-functions-core-tools/bin/workers/powershell/7/Newtonsoft.Json.dll,/azure-node-telegram-bot/node_modules/azure-functions-core-tools/bin/workers/powershell/6/Newtonsoft.Json.dll,/azure-node-line-bot/node_modules/azure-functions-core-tools/bin/workers/powershell/6/Newtonsoft.Json.dll,/azure-node-typescript-servicebus-trigger-endpoint/node_modules/serverless-azure-functions/node_modules/azure-functions-core-tools/bin/Newtonsoft.Json.dll

Dependency Hierarchy: - :x: **Newtonsoft.Json-12.0.3.23909.dll** (Vulnerable Library)

Found in base branch: master

Vulnerability Details

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 (>10kk, 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 = () => 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.**

Publish Date: 2022-06-22

URL: WS-2022-0161

CVSS 3 Score Details (7.5)

Base Score Metrics: - Exploitability Metrics: - Attack Vector: Network - Attack Complexity: Low - Privileges Required: None - User Interaction: None - Scope: Unchanged - Impact Metrics: - Confidentiality Impact: None - Integrity Impact: None - Availability Impact: High

For more information on CVSS3 Scores, click here.

Suggested Fix

Type: Upgrade version

Release Date: 2022-06-22

Fix Resolution: Newtonsoft.Json - 13.0.1;Microsoft.Extensions.ApiDescription.Server - 6.0.0


Step up your Open Source Security Game with Mend here

mend-bolt-for-github[bot] commented 4 months ago

:heavy_check_mark: This issue was automatically closed by Mend because the vulnerable library in the specific branch(es) was either marked as ignored or it is no longer part of the Mend inventory.