Improper Neutralization of CRLF Sequences ('CRLF Injection') vulnerability in benoitc hackney allows HTTP Request/Response Splitting. The WebSocket upgrade code in src/hackney_ws.erl copies the host, path, headers (ExtraHeaders), and protocols options from the caller-supplied opts map into the internal #ws_data{} record in init/1 and then splices them verbatim into the raw HTTP/1.1 upgrade request by binary concatenation in do_handshake/1. No CRLF or NUL stripping is performed at any of these four injection sites. An attacker who controls any of these options — for example by forwarding URL components or header values from untrusted input into hackney_ws:start_link/1 — can inject arbitrary HTTP headers into the outbound WebSocket upgrade request, leading to header injection, credential spoofing toward the upstream server, log and cache poisoning, or request smuggling via intermediary proxies.
This issue affects hackney: from 2.0.0 before 4.0.1.
CVE-2026-47072 is a critical CRLF injection vulnerability in the Erlang hackney WebSocket library (versions 2.0.0-4.0.0) that allows attackers to inject arbitrary HTTP headers into WebSocket upgrade requests through unsanitized user input. This enables header injection, credential spoofing, cache poisoning, and HTTP request smuggling attacks. The vulnerability is particularly severe as it affects real-time communication protocols widely used in Saudi financial and government systems.
IMMEDIATE ACTIONS:
1. Identify all systems running hackney versions 2.0.0-4.0.0 across your infrastructure using dependency scanning tools
2. Isolate affected systems from production traffic if possible pending patching
3. Review WebSocket upgrade request logs for suspicious CRLF sequences or unexpected headers
PATCHING GUIDANCE:
1. Upgrade hackney to version 4.0.1 or later immediately
2. For Erlang/OTP projects: Update rebar3 or mix dependencies to hackney >= 4.0.1
3. Rebuild and redeploy all applications using hackney
4. Verify patch installation by checking hackney version in running processes
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement strict input validation on all parameters passed to hackney_ws:start_link/1 - sanitize host, path, headers, and protocols options
2. Strip CRLF characters (\r\n) and NUL bytes from all user-supplied input before passing to hackney
3. Use allowlist validation for header names and values
4. Implement WAF/proxy rules to detect and block CRLF injection patterns in WebSocket upgrade requests
5. Deploy network segmentation to limit WebSocket traffic to trusted endpoints only
DETECTION RULES:
1. Monitor for HTTP requests containing %0d%0a or \r\n in URL parameters or header values
2. Alert on WebSocket upgrade requests with unexpected or duplicate headers
3. Log all WebSocket connection attempts and review for anomalies
4. Implement IDS signatures for CRLF injection patterns in HTTP traffic
5. Monitor for cache poisoning indicators (conflicting response headers, unexpected content)
VERIFICATION:
1. Test patched systems with CRLF injection payloads to confirm mitigation
2. Review application logs for any exploitation attempts during the vulnerability window
3. Conduct security testing of WebSocket implementations post-patch
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تقوم بتشغيل إصدارات hackney 2.0.0-4.0.0 عبر البنية التحتية باستخدام أدوات فحص التبعيات
2. عزل الأنظمة المتأثرة عن حركة الإنتاج إن أمكن في انتظار التصحيح
3. مراجعة سجلات طلب ترقية WebSocket للتسلسلات المريبة CRLF أو الرؤوس غير المتوقعة
إرشادات التصحيح:
1. ترقية hackney إلى الإصدار 4.0.1 أو أحدث على الفور
2. لمشاريع Erlang/OTP: تحديث تبعيات rebar3 أو mix إلى hackney >= 4.0.1
3. إعادة بناء ونشر جميع التطبيقات التي تستخدم hackney
4. التحقق من تثبيت التصحيح بفحص إصدار hackney في العمليات قيد التشغيل
الضوابط التعويضية (إذا لم يكن التصحيح الفوري ممكناً):
1. تنفيذ التحقق الصارم من المدخلات على جميع المعاملات التي يتم تمريرها إلى hackney_ws:start_link/1 - تعقيم المضيف والمسار والرؤوس والخيارات البروتوكولية
2. إزالة أحرف CRLF (\r\n) وبايتات NUL من جميع المدخلات المزودة من قبل المستخدم قبل التمرير إلى hackney
3. استخدام التحقق من قائمة السماح لأسماء وقيم الرؤوس
4. تنفيذ قواعد WAF/proxy للكشف عن أنماط حقن CRLF وحظرها في طلبات ترقية WebSocket
5. نشر تقسيم الشبكة لتقييد حركة WebSocket إلى نقاط نهاية موثوقة فقط
قواعد الكشف:
1. مراقبة الطلبات التي تحتوي على %0d%0a أو \r\n في معاملات URL أو قيم الرؤوس
2. التنبيه على طلبات ترقية WebSocket برؤوس غير متوقعة أو مكررة
3. تسجيل جميع محاولات الاتصال بـ WebSocket ومراجعة الحالات الشاذة
4. تنفيذ توقيعات IDS لأنماط حقن CRLF في حركة HTTP
5. مراقبة مؤشرات تسمم الذاكرة المؤقتة (رؤوس الاستجابة المتضاربة والمحتوى غير المتوقع)
التحقق:
1. اختبار الأنظمة المصححة باستخدام حمولات حقن CRLF للتأكد من التخفيف
2. مراجعة سجلات التطبيق لأي محاولات استغلال أثناء نافذة الثغرة
3. إجراء اختبار أمان لتطبيقات WebSocket بعد التصحيح