CVE-2022-4904
📋 TL;DR
CVE-2022-4904 is a stack buffer overflow vulnerability in the c-ares DNS library's ares_set_sortlist function. Attackers can trigger denial of service or potentially execute arbitrary code by providing malicious input. Any system or application using vulnerable versions of c-ares is affected.
💻 Affected Systems
- c-ares library
- Applications using c-ares (curl, Node.js, etc.)
📦 What is this software?
C Ares by C Ares Project
Fedora by Fedoraproject
⚠️ Risk & Real-World Impact
Worst Case
Remote code execution leading to complete system compromise if exploit chains with other vulnerabilities.
Likely Case
Denial of service causing application crashes or instability.
If Mitigated
Limited impact with proper input validation and memory protections.
🎯 Exploit Status
Exploitation requires control over input to ares_set_sortlist function.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: c-ares 1.19.1 and later
Vendor Advisory: https://github.com/c-ares/c-ares/releases/tag/cares-1_19_1
Restart Required: Yes
Instructions:
1. Update c-ares to version 1.19.1 or later. 2. Rebuild applications using c-ares. 3. Restart affected services.
🔧 Temporary Workarounds
Input validation wrapper
allAdd input validation before calling ares_set_sortlist
Implement custom validation for sortlist parameter length and format
🧯 If You Can't Patch
- Restrict network access to applications using c-ares
- Implement strict input validation for all ares_set_sortlist calls
🔍 How to Verify
Check if Vulnerable:
Check c-ares version: `ares_version --version` or check package manager
Check Version:
ares_version --version
Verify Fix Applied:
Verify c-ares version is 1.19.1 or later
📡 Detection & Monitoring
Log Indicators:
- Application crashes
- Segmentation faults in c-ares related processes
Network Indicators:
- Unusual DNS query patterns to affected systems
SIEM Query:
Process crashes with c-ares or libcares in stack trace
🔗 References
- https://bugzilla.redhat.com/show_bug.cgi?id=2168631
- https://github.com/c-ares/c-ares/issues/496
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/33LDNS6RPOPP36Z4MPWXALUQZXJCWJS2/
- https://security.gentoo.org/glsa/202401-02
- https://bugzilla.redhat.com/show_bug.cgi?id=2168631
- https://github.com/c-ares/c-ares/issues/496
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/33LDNS6RPOPP36Z4MPWXALUQZXJCWJS2/
- https://security.gentoo.org/glsa/202401-02