PJSIP is a free and open source multimedia communication library written in C. In 2.16 and earlier, there is a buffer overflow when decoding Opus audio frames due to insufficient buffer size validation in the Opus codec decode path. The FEC decode buffers (dec_frame[].buf) were allocated based on a PCM-derived formula: (sample_rate/1000) * 60 * channel_cnt * 2. At 8 kHz mono this yields only 960 bytes, but codec_parse() can output encoded frames up to MAX_ENCODED_PACKET_SIZE (1280) bytes via opus_repacketizer_out_range(). The three pj_memcpy() calls in codec_decode() copied input->size bytes without bounds checking, causing a heap buffer overflow.
PJSIP versions 2.16 and earlier contain a critical heap buffer overflow vulnerability in Opus audio codec decoding due to undersized FEC decode buffers. An attacker can trigger the overflow by sending specially crafted Opus-encoded audio frames, potentially leading to remote code execution or denial of service. This vulnerability affects all organizations using PJSIP for VoIP, unified communications, or multimedia applications.
IMMEDIATE ACTIONS:
1. Identify all systems running PJSIP versions 2.16 and earlier using network scanning and asset inventory tools
2. Isolate or restrict network access to affected PJSIP instances from untrusted networks
3. Disable Opus codec support if not required for business operations
4. Monitor for suspicious audio frame patterns and codec errors in logs
PATCHING GUIDANCE:
1. Upgrade PJSIP to version 2.17 or later immediately
2. Apply patches to all production, staging, and development environments
3. Test patches in non-production environments before deployment
4. Coordinate with telecom vendors for patched PJSIP-dependent applications
COMPENSATING CONTROLS (if immediate patching unavailable):
1. Implement network segmentation to restrict Opus codec traffic
2. Deploy WAF/IPS rules to detect oversized Opus packets (>1280 bytes)
3. Enable memory protection mechanisms (ASLR, DEP/NX) on PJSIP hosts
4. Implement strict input validation at application layer
DETECTION RULES:
1. Monitor for Opus packets exceeding 1280 bytes in size
2. Alert on repeated codec decode errors or application crashes
3. Track heap memory corruption indicators in system logs
4. Monitor for unexpected process termination of PJSIP services
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تقوم بتشغيل إصدارات PJSIP 2.16 وما قبلها باستخدام أدوات المسح والمخزون
2. عزل أو تقييد الوصول إلى شبكة مثيلات PJSIP المتأثرة من الشبكات غير الموثوقة
3. تعطيل دعم برنامج Opus الصوتي إذا لم يكن مطلوباً للعمليات التجارية
4. مراقبة أنماط إطارات صوتية مريبة وأخطاء برنامج في السجلات
إرشادات التصحيح:
1. ترقية PJSIP إلى الإصدار 2.17 أو أحدث على الفور
2. تطبيق التصحيحات على جميع بيئات الإنتاج والتجريب والتطوير
3. اختبار التصحيحات في بيئات غير الإنتاج قبل النشر
4. التنسيق مع موردي الاتصالات للحصول على تطبيقات PJSIP المصححة
الضوابط البديلة (إذا كان التصحيح الفوري غير متاح):
1. تنفيذ تقسيم الشبكة لتقييد حركة برنامج Opus
2. نشر قواعد WAF/IPS للكشف عن حزم Opus الكبيرة الحجم (>1280 بايت)
3. تفعيل آليات حماية الذاكرة (ASLR, DEP/NX) على مضيفي PJSIP
4. تنفيذ التحقق الصارم من المدخلات على مستوى التطبيق
قواعد الكشف:
1. مراقبة حزم Opus التي تتجاوز 1280 بايت في الحجم
2. تنبيه أخطاء فك تشفير برنامج متكررة أو أعطال التطبيق
3. تتبع مؤشرات تلف ذاكرة الكومة في سجلات النظام
4. مراقبة إنهاء العملية غير المتوقع لخدمات PJSIP