Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2021-31684

CVE-2021-31684: Json-smart DOS Vulnerability

CVE-2021-31684 is a denial of service flaw in Json-smart's indexOf function that allows attackers to crash applications via crafted requests. This article covers the technical details, affected versions, and mitigation.

Published:

CVE-2021-31684 Overview

A vulnerability was discovered in the indexOf function of JSONParserByteArray in JSON Smart versions 1.3 and 2.4 which causes a denial of service (DOS) via a crafted web request. This out-of-bounds write vulnerability (CWE-787) allows remote attackers to crash applications that rely on the JSON Smart library for JSON parsing operations.

Critical Impact

Applications using vulnerable JSON Smart library versions can be rendered unavailable through specially crafted malicious JSON input, potentially affecting business continuity and service availability.

Affected Products

  • JSON Smart v1 (version 1.3 and earlier)
  • JSON Smart v2 (version 2.4 and earlier)
  • Oracle Utilities Framework (versions 4.4.0.0.0, 4.4.0.2.0, 4.4.0.3.0)

Discovery Timeline

  • 2021-06-01 - CVE-2021-31684 published to NVD
  • 2022-01 - Oracle releases security patch in CPU January 2022
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-31684

Vulnerability Analysis

The vulnerability resides in the indexOf function within the JSONParserByteArray class of the JSON Smart library. This is classified as an out-of-bounds write vulnerability (CWE-787), which occurs when the software writes data past the end, or before the beginning, of the intended buffer. In this case, the improper boundary handling in the parsing function allows attackers to trigger memory corruption that leads to application crashes.

The vulnerability is exploitable over the network without requiring authentication or user interaction, making it particularly dangerous for web applications and APIs that process untrusted JSON input. The impact is limited to availability (denial of service) with no direct impact on confidentiality or integrity of the affected system.

Root Cause

The root cause lies in improper bounds checking within the indexOf function of JSONParserByteArray. When processing specially crafted JSON input, the function fails to properly validate array boundaries, resulting in an out-of-bounds write operation. This memory safety issue causes the application to crash when it attempts to write data beyond the allocated buffer space.

Attack Vector

The attack vector is network-based, requiring an attacker to send a maliciously crafted web request containing specially formatted JSON data to an application using the vulnerable JSON Smart library. The attack has low complexity, requires no privileges, and needs no user interaction.

An attacker can exploit this vulnerability by:

  1. Identifying a target application that uses JSON Smart versions 1.3 or 2.4 for JSON parsing
  2. Crafting a malicious JSON payload designed to trigger the out-of-bounds write in the indexOf function
  3. Sending the payload via HTTP request to the vulnerable application endpoint
  4. The malformed input causes the parser to crash, resulting in denial of service

For technical details about the vulnerability, see the JSON Smart v1 Issue Report and JSON Smart v2 Issue Report.

Detection Methods for CVE-2021-31684

Indicators of Compromise

  • Unexpected application crashes or restarts in services using JSON Smart library
  • Abnormal JSON parsing errors in application logs
  • Increased rate of malformed JSON requests to application endpoints
  • Memory-related exceptions or stack traces referencing JSONParserByteArray.indexOf

Detection Strategies

  • Implement application performance monitoring to detect service crashes and restarts
  • Monitor application logs for parsing exceptions related to JSON Smart components
  • Use web application firewalls (WAF) to detect and block malformed JSON payloads
  • Employ dependency scanning tools to identify vulnerable JSON Smart library versions in your software inventory

Monitoring Recommendations

  • Set up alerts for unusual patterns of HTTP 500 errors on JSON-processing endpoints
  • Monitor memory usage anomalies that may indicate exploitation attempts
  • Track application uptime metrics and investigate unexpected service interruptions
  • Review network traffic for unusually large or malformed JSON payloads

How to Mitigate CVE-2021-31684

Immediate Actions Required

  • Identify all applications using JSON Smart library versions 1.3 or 2.4
  • Upgrade JSON Smart v1 to a patched version as per the GitHub Pull Request
  • Upgrade JSON Smart v2 to a patched version as per the GitHub Pull Request
  • Apply Oracle Utilities Framework patches if using affected versions (refer to Oracle CPU January 2022)

Patch Information

Security patches are available through the official GitHub repositories:

Workarounds

  • Implement input validation to reject oversized or malformed JSON payloads before they reach the parser
  • Deploy rate limiting on endpoints that process JSON to reduce the impact of DoS attempts
  • Use a web application firewall to filter potentially malicious JSON requests
  • Consider using an alternative JSON parsing library until patches can be applied
bash
# Example Maven dependency update for JSON Smart v2
# Update pom.xml to use patched version
mvn versions:use-latest-releases -Dincludes=net.minidev:json-smart
mvn dependency:tree | grep json-smart

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.