🇰🇷 한글 설명
Linux 커널의 l2tp 모듈 내 pppol2tp_ioctl() 함수에서 세션 참조를 안전하게 관리하지 않아 발생하는 Use-After-Free(UAF) 취약점입니다. copy_from_user() 과정 중 의도적인 지연을 유도하면 세션이 비동기적으로 해제될 수 있으며, 이후 잘못된 메모리 주소에 접근하게 됩니다.
💡 쉬운 설명
프로그램이 사용 중인 데이터가 갑자기 삭제되었음에도 불구하고, 이를 모르고 계속 사용하려고 시도할 때 발생하는 오류입니다. 공격자는 이 허점을 이용해 시스템의 제어권을 획득하거나 오류를 일으킬 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
l2tp: pppol2tp: hold reference to session in pppol2tp_ioctl()
pppol2tp_ioctl() read sock->sk->sk_user_data directly without any
locks or reference counting. If a controllable sleep was induced during
copy_from_user() (e.g. via a userfaultfd page fault sleep), a concurrent
socket close could trigger pppol2tp_session_close() asynchronously. This
frees the l2tp_session structure via the l2tp_session_del_work workqueue.
Upon resuming, the ioctl thread dereferences the stale session pointer,
resulting in a Use-After-Free (UAF).
Fix this by securely fetching the session reference using the RCU-safe,
refcounted helper pppol2tp_sock_to_session(sk) on entry. This locks the
session's refcount across the sleep. We structured the function to exit
via standard err breaks, guaranteeing that l2tp_session_put() is cleanly
called on all return paths to drop the reference.
To preserve existing behavior we validate the session and its magic
signature only for the specific L2TP commands that require it. This
ensures that generic/unknown ioctls called on an unconnected socket
still return -ENOIOCTLCMD and correctly fall back to generic handlers
(e.g. in sock_do_ioctl()).
📍 영향받는 시스템
L2TP 프로토콜을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
userfaultfd 등을 이용해 copy_from_user() 도중 프로세스를 일시 중단시킨 후, 동시에 소켓을 닫아 세션을 해제하는 방식
🛡️ 대응 방법
RCU-safe 및 참조 횟수(refcount)를 사용하는 pppol2tp_sock_to_session(sk) 함수가 적용된 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인하십시오.