In the Linux kernel, the following vulnerability has been resolved:
media: as102: fix to not free memory after the device is registered in as102_usb_probe()
In as102_usb driver, the following race condition occurs:
```
CPU0 CPU1
as102_usb_probe()
kzalloc(); // alloc as102_dev_t
....
usb_register_dev();
fd = sys_open("/path/to/dev"); // open as102 fd
....
usb_deregister_dev();
....
kfree(); // free as102_dev_t
....
sys_close(fd);
as102_release() // UAF!!
as102_usb_release()
kfree(); // DFB!!
```
When a USB character device registered with usb_register_dev() is later
unregistered (via usb_deregister_dev() or disconnect), the device node is
removed so new open() calls fail. However, file descriptors that are
already open do not go away immediately: they remain valid until the last
reference is dropped and the driver's .release() is invoked.
In as102, as102_usb_probe() calls usb_register_dev() and then, on an
error path, does usb_deregister_dev() and frees as102_dev_t right away.
If userspace raced a successful open() before the deregistration, that
open FD will later hit as102_release() --> as102_usb_release() and access
or free as102_dev_t again, occur a race to use-after-free and
double-free vuln.
The fix is to never kfree(as102_dev_t) directly once usb_register_dev()
has succeeded. After deregistration, defer freeing memory to .release().
In other words, let release() perform the last kfree when the final open
FD is closed.
CVE-2026-31578 is a use-after-free (UAF) and double-free vulnerability in the Linux kernel's as102 USB media driver caused by a race condition during device probe and release. An attacker can exploit this by opening a file descriptor to the device before deregistration occurs, leading to memory corruption and potential code execution. This vulnerability affects systems running vulnerable Linux kernel versions with the as102 USB driver enabled.
Immediate Actions:
1. Identify systems running Linux kernel with as102 USB driver enabled (check: lsmod | grep as102)
2. Disable as102 driver if not required: echo 'blacklist as102' >> /etc/modprobe.d/blacklist.conf
3. Restrict USB device access via udev rules to trusted users only
Patching Guidance:
1. Update Linux kernel to patched version (kernel maintainers have released fixes)
2. Apply kernel security updates through your distribution's package manager (apt, yum, dnf)
3. Reboot system after kernel update to load patched version
4. Verify patch: grep -i 'as102.*release' /boot/config-$(uname -r)
Compensating Controls (if immediate patching unavailable):
1. Implement strict USB device access controls via SELinux or AppArmor policies
2. Monitor /dev/as102* device access with auditd: auditctl -w /dev/as102* -p wa -k as102_access
3. Restrict user-level access to USB devices: usermod -G plugdev -a <username>
4. Disable USB autoprobe if not required: echo 'options usb-storage quirks=*:u' >> /etc/modprobe.d/usb-storage.conf
Detection Rules:
1. Monitor kernel logs for UAF/double-free errors: dmesg | grep -i 'use-after-free\|double-free\|as102'
2. Watch for unexpected process termination with SIGSEGV: journalctl -u kernel | grep SIGSEGV
3. Enable kernel address sanitizer (KASAN) in development/test environments
4. Monitor file descriptor operations on /dev/as102*: auditctl -a always,exit -F dir=/dev/ -F name=as102 -F perm=o
الإجراءات الفورية:
1. تحديد الأنظمة التي تقوم بتشغيل نواة Linux مع تفعيل برنامج تشغيل USB as102 (تحقق: lsmod | grep as102)
2. تعطيل برنامج تشغيل as102 إذا لم يكن مطلوباً: echo 'blacklist as102' >> /etc/modprobe.d/blacklist.conf
3. تقييد الوصول إلى جهاز USB عبر قواعد udev للمستخدمين الموثوقين فقط
إرشادات التصحيح:
1. تحديث نواة Linux إلى الإصدار المصحح (أصدر محافظو النواة إصلاحات)
2. تطبيق تحديثات أمان النواة من خلال مدير الحزم الخاص بتوزيعتك (apt, yum, dnf)
3. إعادة تشغيل النظام بعد تحديث النواة لتحميل الإصدار المصحح
4. التحقق من التصحيح: grep -i 'as102.*release' /boot/config-$(uname -r)
الضوابط التعويضية (إذا لم يكن التصحيح الفوري متاحاً):
1. تنفيذ ضوابط وصول صارمة لجهاز USB عبر سياسات SELinux أو AppArmor
2. مراقبة الوصول إلى جهاز /dev/as102* باستخدام auditd: auditctl -w /dev/as102* -p wa -k as102_access
3. تقييد الوصول على مستوى المستخدم إلى أجهزة USB: usermod -G plugdev -a <username>
4. تعطيل اختبار USB التلقائي إذا لم يكن مطلوباً: echo 'options usb-storage quirks=*:u' >> /etc/modprobe.d/usb-storage.conf
قواعد الكشف:
1. مراقبة سجلات النواة للأخطاء: dmesg | grep -i 'use-after-free\|double-free\|as102'
2. مراقبة إنهاء العملية غير المتوقع: journalctl -u kernel | grep SIGSEGV
3. تفعيل مصحح عناوين النواة (KASAN) في بيئات التطوير/الاختبار
4. مراقبة عمليات واصف الملف على /dev/as102*: auditctl -a always,exit -F dir=/dev/ -F name=as102 -F perm=o