urllib3 is an HTTP client library for Python. From 2.6.0 to before 2.7.0, urllib3 could decompress the whole response instead of the requested portion (1) during the second HTTPResponse.read(amt=N) call when the response was decompressed using the official Brotli library or (2) when HTTPResponse.drain_conn() was called after the response had been read and decompressed partially (compression algorithm did not matter here). These issues could cause urllib3 to fully decode a small amount of highly compressed data in a single operation. This could result in excessive resource consumption (high CPU usage and massive memory allocation for the decompressed data) on the client side. This vulnerability is fixed in 2.7.0.
urllib3 versions 2.6.0 to 2.6.x contain a decompression vulnerability (CVE-2026-44432) that can cause excessive resource consumption through uncontrolled decompression of HTTP responses. When reading compressed responses in multiple chunks or calling drain_conn() after partial reads, the library may decompress entire responses instead of requested portions, leading to high CPU usage and massive memory allocation. This affects Python applications using urllib3 for HTTP communication, particularly those handling compressed content from untrusted sources.
IMMEDIATE ACTIONS:
1. Identify all Python applications using urllib3 versions 2.6.0-2.6.x by running: pip list | grep urllib3
2. Audit code for HTTPResponse.read(amt=N) calls with multiple iterations and drain_conn() usage patterns
3. Implement request size limits and timeouts to prevent resource exhaustion
PATCHING GUIDANCE:
1. Upgrade urllib3 to version 2.7.0 or later immediately: pip install --upgrade urllib3>=2.7.0
2. For applications unable to upgrade immediately, pin urllib3 to version 2.5.x or earlier
3. Test thoroughly in staging environment before production deployment
COMPENSATING CONTROLS (if upgrade delayed):
1. Implement strict HTTP response size limits at application level
2. Set aggressive read timeouts (e.g., socket.timeout = 5 seconds)
3. Disable automatic decompression where possible; handle decompression manually with size limits
4. Monitor CPU and memory usage for anomalies; set alerts for >80% sustained usage
5. Implement rate limiting on API endpoints returning compressed responses
DETECTION RULES:
1. Monitor for processes with urllib3 consuming >500MB memory during HTTP operations
2. Alert on CPU spikes (>90%) correlated with urllib3 network operations
3. Log all HTTPResponse.read() calls with amt parameter; flag multiple sequential calls
4. Track drain_conn() invocations after partial reads
5. Implement WAF rules to reject responses >10MB for non-streaming endpoints
الإجراءات الفورية:
1. تحديد جميع تطبيقات Python التي تستخدم urllib3 الإصدارات 2.6.0-2.6.x بتشغيل: pip list | grep urllib3
2. مراجعة الكود للبحث عن استدعاءات HTTPResponse.read(amt=N) مع تكرارات متعددة واستخدام drain_conn()
3. تطبيق حدود حجم الطلب والمهل الزمنية لمنع استنزاف الموارد
إرشادات التصحيح:
1. ترقية urllib3 إلى الإصدار 2.7.0 أو أحدث فوراً: pip install --upgrade urllib3>=2.7.0
2. للتطبيقات غير القادرة على الترقية فوراً، قم بتثبيت urllib3 على الإصدار 2.5.x أو أقدم
3. اختبر بدقة في بيئة التجريب قبل نشر الإنتاج
الضوابط البديلة (إذا تأخر التحديث):
1. تطبيق حدود صارمة لحجم استجابة HTTP على مستوى التطبيق
2. تعيين مهل زمنية قراءة عدوانية (مثل socket.timeout = 5 ثوان)
3. تعطيل فك الضغط التلقائي حيث أمكن؛ معالجة فك الضغط يدويًا مع حدود الحجم
4. مراقبة استخدام CPU والذاكرة للكشف عن الشذوذ؛ تعيين تنبيهات للاستخدام المستمر >80%
5. تطبيق تحديد معدل على نقاط نهاية API التي تُرجع استجابات مضغوطة
قواعد الكشف:
1. مراقبة العمليات التي تستهلك urllib3 أكثر من 500MB من الذاكرة أثناء عمليات HTTP
2. تنبيه على ارتفاعات CPU (>90%) المرتبطة بعمليات شبكة urllib3
3. تسجيل جميع استدعاءات HTTPResponse.read() مع معامل amt؛ وضع علامة على استدعاءات متسلسلة متعددة
4. تتبع استدعاءات drain_conn() بعد القراءات الجزئية
5. تطبيق قواعس WAF لرفض الاستجابات >10MB لنقاط النهاية غير المتدفقة