🇰🇷 한글 설명
Linux 커널의 ipack 드라이버에서 장치 제거 시 발생하는 Use-After-Free(UAF) 및 NULL 포인터 역참조 취약점입니다. TTY 세션이 활성화된 상태에서 장치가 제거될 때 메모리 관리 오류로 인해 시스템 불안정이나 권한 상승이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터 장치를 사용 중인 상태에서 갑자기 뽑았을 때, 시스템이 이미 사라진 메모리 주소를 참조하려고 시도하여 오류가 발생하는 문제입니다. 이로 인해 시스템이 멈추거나 해킹의 통로가 될 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ipack: ipoctal: fix UAF, null-ptr-deref, and use-after-free in cleanup on remove
Three issues arise when the device is removed while a tty session is
still active:
1. UAF of struct ipoctal: the remove callback frees ipoctal via
kfree() while tty ops may still access it. Fix by introducing
kref-based lifetime management — kref is taken in install() when
a tty is opened and released in cleanup() when the tty is finally
destroyed; remove() uses kref_put() instead of kfree().
2. NULL dereference in ipoctal_write_tty(): __ipoctal_remove()
frees xmit_buf via tty_port_free_xmit_buf() while a userspace
process may still hold the tty fd and call write(). Fix by
checking for NULL xmit_buf in ipoctal_write_tty().
3. UAF in ipoctal_cleanup(): ipack_put_carrier(ipoctal->dev)
dereferences ipoctal->dev after the ipack_device has been freed
by ipack_device_del(). Fix by caching ipoctal->carrier_owner
during probe() and calling module_put() on the cached pointer
directly in cleanup(), avoiding any access to ipoctal->dev.
Also introduce a "removed" flag in struct ipoctal, set at the start
of __ipoctal_remove(), and checked in every tty op that accesses
hardware resources (port_activate, write_tty, set_termios, hangup,
shutdown). This prevents page faults when devm_ioremap() regions
are unmapped after remove() returns.
📍 영향받는 시스템
Linux kernel (ipack driver 포함 버전)
⚔️ 공격 벡터
활성화된 TTY 세션을 유지한 상태에서 해당 ipack 장치를 강제로 제거하여 메모리 오류 유도
🛡️ 대응 방법
ipack 드라이버의 kref 기반 수명 관리 및 NULL 체크 로직이 포함된 최신 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인