HIGH
input/alps PS2Mouse UAF
CVE-2025-68822
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
01Description
In the Linux kernel, the following vulnerability has been resolved: Input: alps - fix use-after-free bugs caused by dev3_register_work The dev3_register_work delayed work item is initialized within alps_reconnect() and scheduled upon receipt of the first bare PS/2 packet from an external PS/2 device connected to the ALPS touchpad. During device detachment, the original implementation calls flush_workqueue() in psmouse_disconnect() to ensure completion of dev3_register_work. However, the flush_workqueue() in psmouse_disconnect() only blocks and waits for work items that were already queued to the workqueue prior to its invocation. Any work items submitted after flush_workqueue() is called are not included in the set of tasks that the flush operation awaits. This means that after flush_workqueue() has finished executing, the dev3_register_work could still be scheduled. Although the psmouse state is set to PSMOUSE_CMD_MODE in psmouse_disconnect(), the scheduling of dev3_register_work remains unaffected. The race condition can occur as follows: CPU 0 (cleanup path) | CPU 1 (delayed work) psmouse_disconnect() | psmouse_set_state() | flush_workqueue() | alps_report_bare_ps2_packet() alps_disconnect() | psmouse_queue_work() kfree(priv); // FREE | alps_register_bare_ps2_mouse() | priv = container_of(work...); // USE | priv->dev3 // USE Add disable_delayed_work_sync() in alps_disconnect() to ensure that dev3_register_work is properly canceled and prevented from executing after the alps_data structure has been deallocated. This bug is identified by static analysis.
02KernelScan AI Analysis
Risk summary
Local attackers with low privileges can trigger a use-after-free vulnerability in the ALPS touchpad driver by connecting an external PS/2 mouse during device detachment. This can lead to kernel memory corruption, privilege escalation, or system crashes on systems with ALPS touchpads.
Vulnerability analysis
The vulnerability is a classic use-after-free race condition in the ALPS touchpad driver's cleanup path. The root cause is inadequate synchronization during device disconnection: while psmouse_disconnect() calls flush_workqueue() to wait for pending work items, it cannot prevent new work items from being scheduled after the flush completes. Specifically, the dev3_register_work delayed work can be queued by alps_report_bare_ps2_packet() after flush_workqueue() returns but before alps_disconnect() frees the alps_data structure. The delayed work then executes and accesses the freed memory through container_of(). The fix adds disable_delayed_work_sync() in alps_disconnect() to properly cancel the delayed work and prevent it from executing after memory deallocation. This is a local vulnerability requiring physical access to connect a PS/2 device, but can be triggered by low-privilege users on multi-user systems.
03Fix Versions
| Branch | Fixed in | Patch commit |
|---|---|---|
| 6.12 | 6.12.64 | ed8c61b89be0 |
| 6.18 | 6.18.3 | a9c115e017b2 |
| mainline | 6.19 | bf40644ef8c8 |