🇰🇷 한글 설명
Linux 커널의 ALSA(Advanced Linux Sound Architecture) 구성 요소에서 PCM mmap 작업과 버퍼 재할당 간의 동기화 문제로 인해 Use-After-Free(UAF) 취약점이 발생합니다. 버퍼가 해제된 후에도 해당 페이지에 대한 쓰기 권한이 있는 매핑이 남아 있어, 로컬 권한 상승 공격에 악용될 수 있습니다.
💡 쉬운 설명
사운드 카드를 사용하는 과정에서 메모리를 정리하는 도중, 이미 사용이 끝난 메모리 공간에 누군가 몰래 접근하여 데이터를 쓸 수 있는 보안 구멍이 발견되었습니다. 이를 통해 해커가 일반 사용자 권한에서 관리자 권한을 탈취할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ALSA: pcm: Serialize PCM mmap with buffer reallocation to fix page UAF
snd_pcm_hw_params() and snd_pcm_hw_free() guard buffer reallocation
with an mmap_count check performed under the PCM stream lock, but the
lock is released long before the buffer is actually freed:
snd_pcm_sync_stop(), constraint refinement and do_free_pages() all
happen in between. snd_pcm_mmap_data(), on the other hand, takes no
lock at all: it validates against the old buffer's state and
dma_bytes, remaps its pages into the VMA, and only then increments
mmap_count.
A concurrent mmap() can therefore slip in between the check and the
free. remap_pfn_range() installs writable PTEs for the old buffer's
pages without taking page references, and the subsequent
do_free_pages() returns those pages to the page allocator while the
VMA still maps them. This leaves a stale, writable mapping of freed
pages: a page-level use-after-free that can be leveraged for local
privilege escalation.
Make snd_pcm_mmap_data() participate in the buffer-access scheme
introduced for hw_params/hw_free: acquire runtime->buffer_accessing
before validating and remapping, and release it afterwards. Buffer
reallocation already fails with -EBUSY while accessors are active,
and the mmap side now fails with -EBUSY while a reallocation is in
progress, so the validate/remap sequence and the check/free sequence
can no longer interleave.
A reproducer that turns this race into a stale writable mapping of
the freed DMA buffer pages is available on request.
📍 영향받는 시스템
Linux Kernel (ALSA subsystem)
⚔️ 공격 벡터
로컬 시스템에서 경합 조건(Race Condition)을 유발하여 해제된 메모리 페이지에 대한 쓰기 권한을 획득하는 방식
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 snd_pcm_mmap_data()의 버퍼 접근 동기화 로직을 적용해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.