🇰🇷 한글 설명
Linux 커널의 xfrm 구성 요소에서 모드 설정 실패 시 콜백 함수를 제대로 초기화하지 않아 발생하는 취약점입니다. 설정 실패 후에도 잘못된 콜백 포인터가 남아 있다가, 나중에 관련 모듈이 언로드된 후 가비지 컬렉션(GC)이 실행될 때 잘못된 메모리 주소를 참조하여 커널 패닉을 유발합니다.
💡 쉬운 설명
시스템 설정 중 오류가 발생했을 때 뒷정리가 제대로 되지 않아 발생하는 문제입니다. 이로 인해 나중에 컴퓨터의 핵심 기능인 커널이 갑자기 멈추거나 꺼지는 현상이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
xfrm: clear mode callbacks after failed mode setup
xfrm_state_gc_task can run long after a failed IPTFS state setup. In the
reproduced case, __xfrm_init_state() cached x->mode_cbs, IPTFS setup
returned -ENOMEM before publishing mode_data, and the temporary module
reference from xfrm_get_mode_cbs() was dropped immediately. The dead state
then kept x->mode_cbs until deferred GC ran after xfrm_iptfs had been
unloaded.
Clear x->mode_cbs when mode init or clone fails before publishing
mode_data. Those states never installed mode-specific state or the
long-term IPTFS module pin, so deferred GC has nothing mode-specific to
destroy and must not retain a callback table pointer past the temporary
lookup reference.
The buggy scenario involves two paths, with each column showing the order
within that path:
failed setup path:
1. cache x->mode_cbs
2. mode setup fails before mode_data
3. drop the temporary module ref
4. dead state keeps x->mode_cbs cached
GC/unload path:
1. xfrm_state_put() queues GC work
2. xfrm_iptfs unloads later
3. xfrm_state_gc_task runs
4. GC dereferences stale x->mode_cbs
This also covers the failed clone path where clone_state() returns before
publishing mode_data.
Validation reproduced this kernel report:
Kernel panic - not syncing: Fatal exception
CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
failslab_stacktrace_filter matched xfrm_iptfs frames
ack_error=-12
FAULT_INJECTION: forcing a failure
BUG: unable to handle page fault
Workqueue: events xfrm_state_gc_task
RIP: xfrm_state_gc_task+0x142/0x650
Modules linked in: esp4_offload xfrm_user [last unloaded: xfrm_iptfs]
Kernel panic - not syncing: Fatal exception
📍 영향받는 시스템
xfrm 모듈을 사용하는 Linux 커널 버전 (특히 IPTFS 관련 모듈 사용 시)
⚔️ 공격 벡터
메모리 부족(-ENOMEM) 등을 유도하여 xfrm 상태 설정을 의도적으로 실패시킨 후 커널 패닉 유도
🛡️ 대응 방법
xfrm 모드 설정 또는 복제 실패 시 mode_cbs를 명시적으로 초기화하도록 커널 패치 적용
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 최신 패치 버전인지 확인