CVE-2023-39685

7.5 HIGH

📋 TL;DR

This vulnerability in hjson-java allows attackers to cause Denial of Service (DoS) by sending specially crafted JSON strings. Applications using hjson-java for JSON parsing are affected when processing untrusted input. The vulnerability enables resource exhaustion attacks that can crash or degrade service availability.

💻 Affected Systems

Products:
  • hjson-java
Versions: All versions up to and including v3.0.0
Operating Systems: All platforms running Java
Default Config Vulnerable: ⚠️ Yes
Notes: Any Java application using hjson-java library for JSON parsing is vulnerable when processing untrusted input.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability requiring manual restart, potentially affecting all users of the application.

🟠

Likely Case

Service degradation or temporary unavailability affecting users processing malicious JSON input.

🟢

If Mitigated

Minimal impact with proper input validation and resource limits in place.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending crafted JSON to vulnerable endpoints. No authentication needed if application accepts JSON input from untrusted sources.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v3.1.0 or later

Vendor Advisory: https://github.com/hjson/hjson-java/issues/27

Restart Required: Yes

Instructions:

1. Update hjson-java dependency to v3.1.0 or later in your project's build configuration (pom.xml for Maven, build.gradle for Gradle). 2. Rebuild and redeploy your application. 3. Restart affected services.

🔧 Temporary Workarounds

Input Validation and Size Limits

all

Implement strict input validation and size limits on JSON payloads before passing to hjson-java parser.

Rate Limiting

all

Implement rate limiting on JSON processing endpoints to prevent mass exploitation attempts.

🧯 If You Can't Patch

  • Implement Web Application Firewall (WAF) rules to block suspicious JSON payloads
  • Isolate vulnerable services behind reverse proxies with request filtering capabilities

🔍 How to Verify

Check if Vulnerable:

Check your project's dependency management file (pom.xml or build.gradle) for hjson-java version. If version is 3.0.0 or earlier, you are vulnerable.

Check Version:

For Maven: mvn dependency:tree | grep hjson-java; For Gradle: gradle dependencies | grep hjson-java

Verify Fix Applied:

After updating, verify the hjson-java version in your dependencies is 3.1.0 or later. Test JSON parsing functionality with various inputs.

📡 Detection & Monitoring

Log Indicators:

  • Unusual memory consumption spikes
  • Application crashes or restarts during JSON processing
  • Exception stack traces containing hjson-java classes

Network Indicators:

  • Large or malformed JSON payloads to JSON processing endpoints
  • High volume of requests to JSON endpoints

SIEM Query:

source="application.logs" AND ("OutOfMemoryError" OR "StackOverflowError") AND "hjson"

🔗 References

📤 Share & Export