cpp-httplib is a C++11 single-file header-only cross platform HTTP/HTTPS library. Prior to 0.39.0, the cpp-httplib HTTP client forwards stored Basic Auth, Bearer Token, and Digest Auth credentials to arbitrary hosts when following cross-origin HTTP redirects (301/302/307/308). A malicious or compromised server can redirect the client to an attacker-controlled host, which then receives the plaintext credentials in the `Authorization` header. Version 0.39.0 fixes the issue.
cpp-httplib versions prior to 0.39.0 leak authentication credentials (Basic Auth, Bearer Token, Digest Auth) to arbitrary hosts during HTTP redirects. An attacker can redirect a client to a malicious server and capture plaintext credentials in the Authorization header. This affects any Saudi organization using cpp-httplib in client applications, particularly those handling sensitive API communications. Immediate patching to version 0.39.0 or later is critical.
IMMEDIATE ACTIONS:
1. Inventory all applications and services using cpp-httplib library across your organization
2. Identify which versions are deployed (pre-0.39.0 are vulnerable)
3. Disable HTTP redirects in cpp-httplib client configurations if possible, or implement redirect validation
4. Monitor network traffic for suspicious cross-origin redirects to unfamiliar hosts
PATCHING GUIDANCE:
1. Upgrade cpp-httplib to version 0.39.0 or later immediately
2. Recompile all dependent applications with the patched library
3. Conduct full regression testing before production deployment
4. Prioritize patching for applications handling financial, healthcare, or government data
COMPENSATING CONTROLS (if immediate patching not possible):
1. Implement HTTP redirect validation - whitelist allowed redirect destinations
2. Use certificate pinning for HTTPS connections to prevent MITM attacks
3. Implement network-level controls to block unexpected outbound connections
4. Rotate all credentials (API keys, tokens, passwords) that may have been exposed
5. Enable multi-factor authentication for critical services
6. Implement request signing with short-lived tokens instead of static credentials
DETECTION RULES:
1. Monitor for Authorization header presence in requests to unexpected external hosts
2. Alert on HTTP 301/302/307/308 responses followed by requests to different domains
3. Track cpp-httplib version usage in dependency scanning tools
4. Implement SIEM rules to detect credential patterns in outbound traffic
5. Monitor DNS queries for suspicious domain resolution patterns
الإجراءات الفورية:
1. قم بحصر جميع التطبيقات والخدمات التي تستخدم مكتبة cpp-httplib في جميع أنحاء المنظمة
2. حدد الإصدارات المنتشرة (الإصدارات السابقة للإصدار 0.39.0 معرضة للخطر)
3. عطّل عمليات إعادة التوجيه HTTP في تكوينات عميل cpp-httplib إن أمكن، أو قم بتنفيذ التحقق من إعادة التوجيه
4. راقب حركة الشبكة بحثاً عن عمليات إعادة توجيه مريبة عبر الأصول إلى مضيفين غير معروفين
إرشادات التصحيح:
1. قم بترقية cpp-httplib إلى الإصدار 0.39.0 أو أحدث على الفور
2. أعد ترجمة جميع التطبيقات التابعة باستخدام المكتبة المصححة
3. إجراء اختبار انحدار كامل قبل نشر الإنتاج
4. إعطاء الأولوية لتصحيح التطبيقات التي تتعامل مع البيانات المالية والصحية والحكومية
الضوابط البديلة (إذا لم يكن التصحيح الفوري ممكناً):
1. تنفيذ التحقق من إعادة التوجيه HTTP - قائمة بيضاء للوجهات المسموحة
2. استخدام تثبيت الشهادة لاتصالات HTTPS لمنع هجمات MITM
3. تنفيذ ضوابط على مستوى الشبكة لحظر الاتصالات الصادرة غير المتوقعة
4. تدوير جميع بيانات الاعتماد (مفاتيح API والرموز وكلمات المرور) التي قد تكون قد تعرضت
5. تفعيل المصادقة متعددة العوامل للخدمات الحرجة
6. تنفيذ توقيع الطلب برموز قصيرة الأجل بدلاً من بيانات الاعتماد الثابتة
قواعد الكشف:
1. مراقبة وجود رأس Authorization في الطلبات إلى مضيفين خارجيين غير متوقعين
2. تنبيه على استجابات HTTP 301/302/307/308 متبوعة بطلبات إلى نطاقات مختلفة
3. تتبع استخدام إصدار cpp-httplib في أدوات فحص التبعيات
4. تنفيذ قواعد SIEM للكشف عن أنماط بيانات الاعتماد في حركة المرور الصادرة
5. مراقبة استعلامات DNS لأنماط دقة النطاق المريبة