🇰🇷 한글 설명
Linux 커널의 hp-bioscfg 드라이버에서 sk_store() 및 kek_store() 함수가 힙 영역의 경계를 벗어나 읽는(OOB Read) 취약점이 발견되었습니다. sysfs에 데이터를 쓸 때 줄바꿈 문자를 제거하여 메모리를 할당하지만, 실제 복사 시에는 줄바꿈이 포함된 원래 크기를 사용하여 할당된 범위를 초과해 읽게 됩니다.
💡 쉬운 설명
컴퓨터가 데이터를 저장할 공간을 실제 데이터보다 아주 조금 작게 만들어놓고, 데이터를 읽을 때는 원래 크기만큼 읽으려다 보니 허용되지 않은 옆 동네 메모리까지 읽어버리는 문제입니다. 이로 인해 시스템의 민감한 정보가 유출될 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
platform/x86: hp-bioscfg: fix heap OOB read in sk_store() and kek_store()
sk_store() and kek_store() strip a trailing newline from the sysfs
write before allocating the key buffer:
length = count;
if (buf[length - 1] == '\n')
length--;
bioscfg_drv.spm_data.signing_key = kmemdup(buf, length, GFP_KERNEL);
but then pass the original "count" (not "length") as the copy size to
hp_wmi_perform_query(), which memcpy()s that many bytes out of the
"length"-sized allocation, reading one byte past it whenever the write
ends in a newline, the normal case for a shell "echo" into sysfs.
KASAN confirms this directly:
BUG: KASAN: slab-out-of-bounds in hp_wmi_perform_query+0x1e9/0x460 [hp_bioscfg]
Read of size 28 at addr ffff88813c8e2b80 by task python3/16022
...
sk_store+0xa7/0x240 [hp_bioscfg]
kernfs_fop_write_iter+0x3e1/0x5d0
...
The buggy address is located 0 bytes inside of
allocated 27-byte region [ffff88813c8e2b80, ffff88813c8e2b9b)
Reproduced identically for kek_store, and at multiple write sizes
(28, 57, 201 bytes), each time reading exactly one byte past a
kmemdup() allocation one byte smaller than the write.
Fix by passing "length" instead of "count" to hp_wmi_perform_query()
in both functions.
📍 영향받는 시스템
hp-bioscfg 드라이버를 사용하는 Linux 커널 기반 시스템
⚔️ 공격 벡터
sysfs 인터페이스를 통해 줄바꿈 문자가 포함된 데이터를 입력하여 메모리 경계 외 읽기 유도
🛡️ 대응 방법
hp-bioscfg 드라이버의 sk_store() 및 kek_store() 함수에서 hp_wmi_perform_query() 호출 시 'count' 대신 수정된 'length'를 전달하도록 커널 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 패치된 최신 보안 업데이트가 적용되었는지 확인합니다.