CVE-2023-49355
📋 TL;DR
This vulnerability in jq's decNumber library allows a one-byte out-of-bounds write when processing specially crafted numeric input strings. Attackers could potentially execute arbitrary code or cause denial of service. Anyone using vulnerable versions of jq to process untrusted input is affected.
💻 Affected Systems
- jq
📦 What is this software?
Jq by Jqlang
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise if jq processes attacker-controlled input.
Likely Case
Application crash or denial of service when processing malicious input.
If Mitigated
Limited impact if jq only processes trusted input sources with proper input validation.
🎯 Exploit Status
Exploit requires sending specially crafted input like "[]-1.2e-1111111111" to jq. The vulnerability is well-documented with public proof-of-concept.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Versions after commit 88f01a7
Vendor Advisory: https://github.com/jqlang/jq/security/advisories
Restart Required: No
Instructions:
1. Update jq to latest version using package manager. 2. For source installations: git clone latest jq repository, compile and install. 3. Verify installation with 'jq --version'.
🔧 Temporary Workarounds
Input Validation Filter
linuxFilter out problematic numeric patterns before passing to jq
sed -E 's/\[\]\-[0-9]+\.[0-9]+e\-[0-9]{10,}//g' input.json | jq .
Sandbox Execution
linuxRun jq in restricted environment with limited permissions
firejail --net=none --private jq . input.json
🧯 If You Can't Patch
- Implement strict input validation to reject scientific notation with extremely large exponents
- Run jq with memory protection mechanisms like ASLR and DEP enabled
🔍 How to Verify
Check if Vulnerable:
Test with vulnerable input: echo '[]-1.2e-1111111111' | jq . 2>&1 | grep -i 'overflow\|segmentation\|abort'
Check Version:
jq --version | head -1
Verify Fix Applied:
After update, test with same input and ensure normal error handling instead of crash
📡 Detection & Monitoring
Log Indicators:
- Segmentation fault messages
- Abnormal jq process termination
- Memory corruption errors in system logs
Network Indicators:
- Unusually large numeric strings in input data
- Patterns matching scientific notation with large exponents
SIEM Query:
process_name:"jq" AND (event_type:"crash" OR error_message:"segmentation fault")
🔗 References
- https://github.com/jqlang/jq/blob/88f01a741c8d63c4d1b5bc3ef61520c6eb93edaa/src/decNumber/decNumber.c#L3764
- https://github.com/jqlang/jq/tree/88f01a741c8d63c4d1b5bc3ef61520c6eb93edaa
- https://github.com/linzc21/bug-reports/blob/main/reports/jq/1.7-37-g88f01a7/heap-buffer-overflow/CVE-2023-49355.md
- https://github.com/jqlang/jq/blob/88f01a741c8d63c4d1b5bc3ef61520c6eb93edaa/src/decNumber/decNumber.c#L3764
- https://github.com/jqlang/jq/tree/88f01a741c8d63c4d1b5bc3ef61520c6eb93edaa
- https://github.com/linzc21/bug-reports/blob/main/reports/jq/1.7-37-g88f01a7/heap-buffer-overflow/CVE-2023-49355.md