CVE-2022-45493

7.8 HIGH

📋 TL;DR

This is a buffer overflow vulnerability in the json_parse_key function of the sheredom json.h library. It allows attackers to execute arbitrary code and potentially gain escalated privileges on systems using vulnerable versions of this JSON parsing library. Anyone using software that incorporates this library before the fixed commit is affected.

💻 Affected Systems

Products:
  • sheredom json.h library
  • Any software using vulnerable versions of sheredom json.h
Versions: All versions before commit 0825301a07cbf51653882bf2b153cc81fdadf41 (November 14, 2022)
Operating Systems: All operating systems where the library is used
Default Config Vulnerable: ⚠️ Yes
Notes: This is a header-only C library, so any project including the vulnerable json.h file is affected regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, privilege escalation to root/admin, and persistent backdoor installation.

🟠

Likely Case

Application crash (denial of service) or limited code execution within the application's context, potentially leading to data theft or further lateral movement.

🟢

If Mitigated

Application crash with no code execution if memory protections (ASLR, DEP) are effective, but still causing service disruption.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Buffer overflow exploitation requires crafting malicious JSON input, but the vulnerability is in a core parsing function that handles untrusted data.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Commit 0825301a07cbf51653882bf2b153cc81fdadf41 or later

Vendor Advisory: https://github.com/hyrathon/trophies/security/advisories/GHSA-r2mm-2f4c-6243

Restart Required: Yes

Instructions:

1. Update to json.h from commit 0825301a07cbf51653882bf2b153cc81fdadf41 or later. 2. Replace the vulnerable json.h file in your project. 3. Recompile all affected software. 4. Restart services using the patched library.

🔧 Temporary Workarounds

Input Validation

all

Implement strict input validation and size limits on JSON data before passing to json_parse_key function

Memory Protection

all

Enable ASLR, DEP, and stack canaries if not already enabled to make exploitation more difficult

For Linux: echo 2 > /proc/sys/kernel/randomize_va_space
For Windows: Enable Data Execution Prevention (DEP) in system properties

🧯 If You Can't Patch

  • Network segmentation to isolate systems using vulnerable library
  • Implement strict input filtering and rate limiting for JSON parsing endpoints

🔍 How to Verify

Check if Vulnerable:

Check if your json.h file contains the vulnerable json_parse_key function without bounds checking on line ~1300

Check Version:

git log --oneline json.h | head -5

Verify Fix Applied:

Verify json.h includes commit 0825301a07cbf51653882bf2b153cc81fdadf41 or check that json_parse_key has proper bounds checking

📡 Detection & Monitoring

Log Indicators:

  • Application crashes with segmentation faults
  • Unusual memory access patterns in application logs
  • Large or malformed JSON input logs

Network Indicators:

  • Unusually large JSON payloads to parsing endpoints
  • Repeated malformed JSON requests

SIEM Query:

source="application.logs" AND ("segmentation fault" OR "buffer overflow" OR "json_parse")

🔗 References

📤 Share & Export