🇰🇷 한글 설명
리눅스 커널의 DAMON 시스템에서 contexts 배열 접근 전 nr 값 검증 부재로 인해 NULL 포인터 역참조 취약점이 발생했습니다. 특권 사용자는 sysfs를 통해 nr_contexts를 0으로 설정한 후 특정 명령을 실행하여 커널 패닉을 유발할 수 있습니다.
💡 쉬운 설명
시스템 관리자 권한을 가진 사용자가 DAMON 설정을 변경하는 과정에서 커널이 비정상적으로 종료될 수 있는 결함이 있습니다. 이는 설정 값을 0으로 바꾼 후 특정 명령을 실행하면 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mm/damon/sysfs: check contexts->nr before accessing contexts_arr[0]
Multiple sysfs command paths dereference contexts_arr[0] without first
verifying that kdamond->contexts->nr == 1. A user can set nr_contexts to
0 via sysfs while DAMON is running, causing NULL pointer dereferences.
In more detail, the issue can be triggered by privileged users like
below.
First, start DAMON and make contexts directory empty
(kdamond->contexts->nr == 0).
# damo start
# cd /sys/kernel/mm/damon/admin/kdamonds/0
# echo 0 > contexts/nr_contexts
Then, each of below commands will cause the NULL pointer dereference.
# echo update_schemes_stats > state
# echo update_schemes_tried_regions > state
# echo update_schemes_tried_bytes > state
# echo update_schemes_effective_quotas > state
# echo update_tuned_intervals > state
Guard all commands (except OFF) at the entry point of
damon_sysfs_handle_cmd().
📍 영향받는 시스템
Linux kernel (DAMON subsystem)
⚔️ 공격 벡터
특권 사용자가 sysfs 인터페이스를 통해 nr_contexts를 0으로 설정한 후 damon_sysfs_handle_cmd 진입점의 명령을 실행
🛡️ 대응 방법
커널 패치 적용 및 damon_sysfs_handle_cmd 함수에서 contexts->nr 검증 로직 추가
🔧 검증 코드
출력된 커널 버전이 취약한 버전 범위 내에 있는지 확인하고, 해당 버전 사용자는 즉시 커널 업데이트를 수행해야 함