CVE-2022-25024

7.5 HIGH

📋 TL;DR

CVE-2022-25024 is a denial-of-service vulnerability in the Python json2xml package where malformed input triggers an unhandled exception, crashing the application. This affects any Python application using json2xml version 3.12.0 or earlier to process untrusted JSON data. The vulnerability requires an attacker to supply malicious input to the json2xml conversion function.

💻 Affected Systems

Products:
  • json2xml Python package
Versions: All versions through 3.12.0
Operating Systems: All platforms running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Only vulnerable when processing untrusted JSON input through json2xml conversion functions.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete application crash leading to sustained denial of service, potentially affecting availability of dependent services.

🟠

Likely Case

Application crashes when processing malicious JSON input, requiring restart and causing temporary service disruption.

🟢

If Mitigated

Minimal impact with proper input validation and error handling in place; application continues with graceful error handling.

🌐 Internet-Facing: MEDIUM - Requires attacker to send malicious JSON to vulnerable endpoint; many applications don't expose json2xml directly.
🏢 Internal Only: LOW - Requires internal attacker or compromised internal system to send malicious input to vulnerable service.

🎯 Exploit Status

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

Exploit requires sending malformed JSON to vulnerable endpoint; proof-of-concept available in GitHub issues.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 3.13.0 and later

Vendor Advisory: https://github.com/vinitkumar/json2xml/issues/106

Restart Required: Yes

Instructions:

1. Update json2xml: pip install --upgrade json2xml
2. Verify version: pip show json2xml
3. Restart any services using json2xml
4. Test with known malicious inputs to confirm fix

🔧 Temporary Workarounds

Input Validation Wrapper

all

Wrap json2xml calls with input validation to reject malformed JSON before processing

import json
import json2xml

def safe_json2xml(json_str):
    try:
        json.loads(json_str)  # Validate JSON first
        return json2xml.Json2xml(json.loads(json_str)).to_xml()
    except json.JSONDecodeError:
        return "Invalid JSON input"
    except Exception as e:
        return f"Processing error: {str(e)}"

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all JSON inputs before passing to json2xml
  • Deploy web application firewall (WAF) rules to block malformed JSON payloads targeting json2xml endpoints

🔍 How to Verify

Check if Vulnerable:

Check json2xml version: pip show json2xml | grep Version. If version is 3.12.0 or earlier, system is vulnerable.

Check Version:

pip show json2xml | grep Version

Verify Fix Applied:

Test with malformed JSON input that previously caused crashes; application should handle gracefully without crashing.

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with unhandled exceptions from json2xml module
  • Error logs containing 'json2xml' and stack traces
  • Repeated service restarts after JSON processing

Network Indicators:

  • Unusual JSON payloads sent to application endpoints
  • Multiple connection attempts with malformed JSON

SIEM Query:

source="application.logs" AND ("json2xml" OR "Json2xml") AND ("exception" OR "crash" OR "error")

🔗 References

📤 Share & Export