CVE-2021-23900: Denial of Service in json-sanitizer

Summary

13/05/2021
Yes i
High
7.5

CVE-2021-23900: Uncaught Exception leading to Denial of Service in json-sanitizer. Affects com.mikesamuel:json-sanitizer versions < 1.2.2. Fixed in 1.2.2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The json-sanitizer package, developed by com.mikesamuel, is a Maven ecosystem library used for sanitizing JSON input. It ensures that the output JSON is safe and conforms to the JSON specification. However, versions before 1.2.2 are vulnerable to a Denial of Service (DoS) attack. This vulnerability can lead to the generation of invalid JSON or trigger an undeclared exception when processing specially crafted input. Applications that do not handle these situations properly may experience a DoS condition.

Vulnerability Detail

The vulnerability (CVE-2021-23900) in json-sanitizer arises due to improper handling of crafted input. Attackers can exploit this vulnerability to cause a DoS condition in the target application. By providing malicious input, the json-sanitizer library may generate invalid JSON or throw an unexpected exception. This can overload the application, leading to service disruption or unhandled exceptions. The severity of this vulnerability is rated as HIGH with a CVSS score of 7.5.

How To Fix

Minimum fixed version

1.2.2

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can implement input validation and sanitization mechanisms in their application code. By validating and sanitizing JSON input before passing it to the json-sanitizer library, the risk of triggering the vulnerability can be mitigated. Here's an example of how to sanitize JSON input using the json-sanitizer library in Java:

import com.mikesamuel.json.JsonSanitizer;

String inputJson = ...; // JSON input from user
String sanitizedJson = JsonSanitizer.sanitize(inputJson);
// Use the sanitized JSON in your application

Conclusion

The json-sanitizer package before version 1.2.2 is vulnerable to a Denial of Service (DoS) attack. Attackers can exploit this vulnerability to generate invalid JSON or trigger unhandled exceptions, leading to service disruption. To mitigate this risk, it is crucial to upgrade to json-sanitizer version 1.2.2 or later. Additionally, implementing input validation and sanitization mechanisms in your application code can provide temporary protection. For further support or assistance, please contact DevNack.com.

See every vulnerability recorded for com.mikesamuel:json-sanitizer →

Share this vulnerability

FAQ

The vulnerability in json-sanitizer can lead to a Denial of Service (DoS) condition in the target application. This can result in service disruption or unhandled exceptions, potentially impacting the availability and reliability of the application.

You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using only the pom.xml file of your project.

At the time of this report, there are no known public exploits specifically targeting this vulnerability. However, it is important to promptly apply the recommended fixes to mitigate the risk of exploitation.

Yes, you can implement input validation and sanitization mechanisms in your application code to reduce the risk of triggering the vulnerability. By validating and sanitizing JSON input before passing it to the json-sanitizer library, you can mitigate the impact of this vulnerability.

For further support or assistance regarding vulnerability remediation, you can reach out to info@devnack.com. Our team of experts will be happy to assist you.

Related vulnerabilities

Recent vulnerabilities recorded for com.mikesamuel:json-sanitizer.

How To Fix

Minimum fixed version

1.2.2

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback