CVE-2023-5072

7.5 HIGH

📋 TL;DR

CVE-2023-5072 is a denial-of-service vulnerability in JSON-Java library where specially crafted JSON input causes excessive memory consumption, potentially crashing applications. This affects any application using vulnerable JSON-Java versions to parse untrusted JSON data. The vulnerability requires no authentication and can be triggered remotely.

💻 Affected Systems

Products:
  • JSON-Java (org.json:json)
Versions: All versions up to and including 20230618
Operating Systems: All operating systems
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using vulnerable JSON-Java library to parse JSON from untrusted sources is affected. This includes web applications, APIs, and services that accept JSON input.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete application crash and service unavailability due to memory exhaustion, potentially affecting multiple services if shared infrastructure is impacted.

🟠

Likely Case

Application instability, degraded performance, or service crashes when processing malicious JSON payloads from untrusted sources.

🟢

If Mitigated

Limited impact with proper input validation, memory limits, and isolation of JSON parsing components.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending specially crafted JSON payloads to vulnerable endpoints. The vulnerability is well-documented with public proof-of-concept examples available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 20231013 and later

Vendor Advisory: https://github.com/stleary/JSON-java/security/advisories/GHSA-8v9q-7r4c-4c5h

Restart Required: Yes

Instructions:

1. Update JSON-Java dependency to version 20231013 or later. 2. For Maven: Update pom.xml to <version>20231013</version>. 3. For Gradle: Update build.gradle to implementation 'org.json:json:20231013'. 4. Restart affected applications.

🔧 Temporary Workarounds

Input Validation and Size Limits

all

Implement strict input validation and size limits on JSON payloads before parsing

Configure web server/application to reject JSON payloads exceeding reasonable size limits

Memory Limit Configuration

all

Configure JVM memory limits and monitoring to detect and prevent memory exhaustion

java -Xmx512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/dumps

🧯 If You Can't Patch

  • Implement WAF rules to block suspicious JSON payloads and monitor for memory exhaustion patterns
  • Isolate JSON parsing to dedicated containers with strict resource limits and automatic restart policies

🔍 How to Verify

Check if Vulnerable:

Check project dependencies for JSON-Java version 20230618 or earlier. For Maven: mvn dependency:tree | grep json. For Gradle: gradle dependencies | grep json.

Check Version:

java -cp json-*.jar org.json.JSONObject --version or check build configuration files

Verify Fix Applied:

Verify JSON-Java version is 20231013 or later. Test with known malicious JSON payloads to ensure no memory exhaustion occurs.

📡 Detection & Monitoring

Log Indicators:

  • OutOfMemoryError exceptions
  • High memory usage spikes during JSON parsing
  • Application crashes or restarts after JSON processing

Network Indicators:

  • Large or malformed JSON payloads to JSON endpoints
  • Repeated JSON requests causing performance degradation

SIEM Query:

source="application.logs" AND ("OutOfMemoryError" OR "java.lang.OutOfMemoryError") AND "JSON"

🔗 References

📤 Share & Export