🇰🇷 한글 설명
Linux 커널의 ALPS 터치패드 드라이버에서 dev3_register_work 작업이 적절히 취소되지 않아 발생하는 Use-After-Free 취약점입니다. 장치 분리 시 flush_workqueue()가 실행된 이후에 지연된 작업이 스케줄링될 수 있어, 이미 해제된 메모리 영역에 접근을 시도하는 레이스 컨디션이 발생합니다.
💡 쉬운 설명
터치패드를 컴퓨터에서 분리할 때, 컴퓨터가 아직 처리 중인 작업을 완전히 멈추지 못해 이미 사라진 데이터를 다시 읽으려다 오류가 발생하는 문제입니다. 이로 인해 시스템이 충돌하거나 보안 문제가 생길 수 있습니다.
🇺🇸 원문 (English)
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.
📍 영향받는 시스템
ALPS 터치패드 드라이버를 사용하는 Linux 커널 시스템
⚔️ 공격 벡터
물리적 장치 연결/해제 과정에서의 레이스 컨디션을 이용한 메모리 오염
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하거나 alps_disconnect()에 disable_delayed_work_sync()가 포함된 패치를 적용하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인하십시오.