🇰🇷 한글 설명
Linux 커널의 accel/ethosu 드라이버에서 ethosu_gem_cmdstream_copy_and_validate() 함수 내의 경계 외(OOB) 쓰기 취약점이 발견되었습니다. 64비트 명령어를 처리할 때 인덱스를 추가로 증가시키지만, 증가된 인덱스가 버퍼 범위를 벗어나는지 재검사하지 않아 힙 메모리 오염이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터의 명령어를 처리하는 과정에서 정해진 메모리 공간보다 더 많은 데이터를 쓰려고 시도하는 오류가 있습니다. 공격자가 이를 악용하면 시스템의 중요한 메모리 영역을 망가뜨릴 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
accel/ethosu: fix OOB write in ethosu_gem_cmdstream_copy_and_validate()
The command stream parsing loop increments the index variable a second
time when a 64-bit command word is encountered (bit 14 set), but does
not re-check the loop bound before writing the second word:
for (i = 0; i < size / 4; i++) {
bocmds[i] = cmds[0];
if (cmd & 0x4000) {
i++;
bocmds[i] = cmds[1]; /* unchecked */
}
}
The buffer bocmds is backed by a DMA allocation of exactly size bytes
from drm_gem_dma_create(ddev, size), giving valid indices [0, size/4-1].
When i == size/4 - 1 on entry to an iteration and bit 14 of cmds[0] is
set, bocmds[size/4-1] is written in bounds, i is then incremented to
size/4, and bocmds[size/4] writes four bytes past the end of the
allocation.
Userspace controls both the buffer contents and the size argument via
the ioctl, making this a userspace-triggerable heap out-of-bounds write.
Fix by checking the incremented index against the buffer bound before
the second write and returning -EINVAL if the buffer is too small to
contain the extended command.
📍 영향받는 시스템
Linux kernel (accel/ethosu driver 포함 버전)
⚔️ 공격 벡터
사용자 공간(Userspace)에서 ioctl을 통해 조작된 버퍼 내용과 크기를 전달하여 힙 오버플로우 유도
🛡️ 대응 방법
커널 패치를 적용하여 명령어 처리 시 인덱스 범위를 검사하도록 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 취약점이 수정된 최신 패치 버전인지 확인