In the Linux kernel, the following vulnerability has been resolved:
usb: gadget: f_uac1_legacy: validate control request size
f_audio_complete() copies req->length bytes into a 4-byte stack
variable:
u32 data = 0;
memcpy(&data, req->buf, req->length);
req->length is derived from the host-controlled USB request path,
which can lead to a stack out-of-bounds write.
Validate req->actual against the expected payload size for the
supported control selectors and decode only the expected amount
of data.
This avoids copying a host-influenced length into a fixed-size
stack object.
CVE-2026-31720 is a stack buffer overflow vulnerability in the Linux kernel's USB audio gadget driver (f_uac1_legacy) that allows remote attackers to write beyond a 4-byte stack variable through malformed USB control requests. With a CVSS score of 7.8, this vulnerability enables denial of service and potential code execution on systems exposing USB audio gadget functionality. The vulnerability affects Linux kernel versions up to 7.0-rc3 and requires immediate patching for systems utilizing USB audio device emulation.
Immediate Actions:
1. Identify all systems running affected Linux kernel versions (pre-7.0-rc4) with USB audio gadget functionality enabled
2. Disable USB audio gadget driver (f_uac1_legacy) if not required: echo 'blacklist usb_f_uac1_legacy' >> /etc/modprobe.d/blacklist.conf
3. Restrict USB device access through physical controls and BIOS settings where possible
Patching Guidance:
1. Update Linux kernel to version 7.0-rc4 or later
2. For enterprise distributions, apply vendor-specific patches: RHEL/CentOS, Ubuntu, Debian kernel updates
3. Verify patch application: grep -i 'validate control request size' /usr/src/linux/drivers/usb/gadget/f_uac1_legacy.c
Compensating Controls (if immediate patching unavailable):
1. Implement strict USB device policy via udev rules to prevent unauthorized USB audio device attachment
2. Monitor USB device enumeration logs for suspicious control requests
3. Isolate affected systems from untrusted USB sources
4. Implement network segmentation for systems requiring USB audio functionality
Detection Rules:
1. Monitor kernel logs for USB gadget errors: grep 'f_uac1_legacy\|usb.*error' /var/log/kern.log
2. Alert on unusual USB control request sizes exceeding 4 bytes for audio control selectors
3. Monitor for stack corruption indicators and kernel panics related to USB subsystem
4. Implement IDS signatures detecting malformed USB audio control requests with oversized payloads
الإجراءات الفورية:
1. تحديد جميع الأنظمة التي تعمل بإصدارات نواة Linux المتأثرة (قبل 7.0-rc4) مع تفعيل وظائف جهاز الصوت USB
2. تعطيل برنامج تشغيل جهاز الصوت USB (f_uac1_legacy) إذا لم يكن مطلوبًا: echo 'blacklist usb_f_uac1_legacy' >> /etc/modprobe.d/blacklist.conf
3. تقييد الوصول إلى جهاز USB من خلال الضوابط المادية وإعدادات BIOS حيث أمكن
إرشادات التصحيح:
1. تحديث نواة Linux إلى الإصدار 7.0-rc4 أو أحدث
2. بالنسبة للتوزيعات الموجهة للمؤسسات، تطبيق التصحيحات الخاصة بالبائع: تحديثات نواة RHEL/CentOS و Ubuntu و Debian
3. التحقق من تطبيق التصحيح: grep -i 'validate control request size' /usr/src/linux/drivers/usb/gadget/f_uac1_legacy.c
الضوابط البديلة (إذا لم يكن التصحيح الفوري متاحًا):
1. تنفيذ سياسة جهاز USB صارمة عبر قواعد udev لمنع إرفاق جهاز صوت USB غير مصرح به
2. مراقبة سجلات تعداد جهاز USB للطلبات المريبة
3. عزل الأنظمة المتأثرة عن مصادر USB غير الموثوقة
4. تنفيذ تقسيم الشبكة للأنظمة التي تتطلب وظائف صوت USB
قواعد الكشف:
1. مراقبة سجلات النواة لأخطاء جهاز USB: grep 'f_uac1_legacy\|usb.*error' /var/log/kern.log
2. التنبيه على أحجام طلبات التحكم USB غير العادية التي تتجاوز 4 بايتات لمحددات التحكم الصوتي
3. مراقبة مؤشرات تلف المكدس والأعطال الحرجة للنواة المتعلقة بنظام فرعي USB
4. تنفيذ توقيعات IDS للكشف عن طلبات التحكم الصوتي USB المشوهة ذات الحمولات الكبيرة