CVE-2024-26134
📋 TL;DR
This vulnerability in the cbor2 Python library allows attackers to cause denial-of-service by sending specially crafted CBOR objects that trigger excessive memory consumption. Services using cbor2 versions 5.5.1 through 5.6.1 for parsing untrusted CBOR data are affected. The vulnerability can crash applications that process CBOR input from external sources.
💻 Affected Systems
- cbor2 Python library
📦 What is this software?
Cbor2 by Agronholm
Fedora by Fedoraproject
Fedora by Fedoraproject
Fedora by Fedoraproject
⚠️ Risk & Real-World Impact
Worst Case
Complete service outage through resource exhaustion, potentially affecting multiple dependent services in a chain.
Likely Case
Service crashes or becomes unresponsive when processing malicious CBOR payloads, requiring restart.
If Mitigated
Limited impact with proper input validation and resource limits in place, though service may still experience degraded performance.
🎯 Exploit Status
The advisory includes example payloads. Exploitation requires sending CBOR data to a vulnerable endpoint, making it easy to weaponize for DoS attacks.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 5.6.2
Vendor Advisory: https://github.com/agronholm/cbor2/security/advisories/GHSA-375g-39jq-vq7m
Restart Required: Yes
Instructions:
1. Update cbor2 using pip: 'pip install --upgrade cbor2==5.6.2' 2. Restart all services using cbor2 3. Verify the update with 'pip show cbor2'
🔧 Temporary Workarounds
Input size limiting
allImplement size limits on incoming CBOR data before parsing
# Python example: check data size before parsing
if len(cbor_data) > MAX_ALLOWED_SIZE:
raise ValueError('CBOR data too large')
Resource limits
linuxUse resource limits or timeouts when parsing CBOR data
# Python example with timeout
import signal
class TimeoutException(Exception):
pass
def timeout_handler(signum, frame):
raise TimeoutException()
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(5) # 5 second timeout
try:
result = cbor2.loads(data)
finally:
signal.alarm(0)
🧯 If You Can't Patch
- Implement strict input validation and size limits on all CBOR parsing endpoints
- Deploy network-level protections like WAF rules to block suspicious CBOR payloads
🔍 How to Verify
Check if Vulnerable:
Check cbor2 version with 'pip show cbor2' or 'python -c "import cbor2; print(cbor2.__version__)"' and verify it's between 5.5.1 and 5.6.1 inclusive.
Check Version:
python -c "import cbor2; print(cbor2.__version__)"
Verify Fix Applied:
Confirm version is 5.6.2 or higher with 'pip show cbor2' and test with known malicious payloads from the advisory.
📡 Detection & Monitoring
Log Indicators:
- Application crashes or restarts after processing CBOR data
- Memory usage spikes in cbor2 parsing functions
- Timeout errors in CBOR processing endpoints
Network Indicators:
- Large CBOR payloads sent to vulnerable endpoints
- Repeated CBOR requests causing service degradation
SIEM Query:
source="application.logs" AND ("cbor2" OR "CBOR") AND ("crash" OR "memory" OR "timeout" OR "restart")
🔗 References
- https://github.com/agronholm/cbor2/commit/387755eacf0be35591a478d3c67fe10618a6d542
- https://github.com/agronholm/cbor2/commit/4de6991ba29bf2290d7b9d83525eda7d021873df
- https://github.com/agronholm/cbor2/pull/204
- https://github.com/agronholm/cbor2/releases/tag/5.6.2
- https://github.com/agronholm/cbor2/security/advisories/GHSA-375g-39jq-vq7m
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BT42VXZMMMCSSHMA65KKPOZCXJEYHNR5/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GX524ZG2XJWFV37UQKQ4LWIH4UICSGEQ/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PWC3VU6YV6EXKCSX5GTKWLBZIDIJNQJY/
- https://github.com/agronholm/cbor2/commit/387755eacf0be35591a478d3c67fe10618a6d542
- https://github.com/agronholm/cbor2/commit/4de6991ba29bf2290d7b9d83525eda7d021873df
- https://github.com/agronholm/cbor2/pull/204
- https://github.com/agronholm/cbor2/releases/tag/5.6.2
- https://github.com/agronholm/cbor2/security/advisories/GHSA-375g-39jq-vq7m
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BT42VXZMMMCSSHMA65KKPOZCXJEYHNR5/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/GX524ZG2XJWFV37UQKQ4LWIH4UICSGEQ/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/PWC3VU6YV6EXKCSX5GTKWLBZIDIJNQJY/