🇰🇷 한글 설명
Linux 커널의 mtd spi-nor 드라이버 내 debugfs의 spi_nor_params_show() 함수에서 경계 외 읽기(Out-of-bounds read) 취약점이 발견되었습니다. 배열의 크기를 계산할 때 요소의 개수가 아닌 바이트 크기를 전달하여, 실제 배열 범위를 초과하는 메모리 영역을 읽을 수 있는 문제입니다.
💡 쉬운 설명
프로그램이 목록의 개수를 세는 과정에서 실수로 실제 개수보다 8배나 더 큰 숫자를 읽으라고 명령한 상황입니다. 이로 인해 허용되지 않은 메모리 영역의 정보를 몰래 읽어갈 위험이 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
mtd: spi-nor: debugfs: fix out-of-bounds read in spi_nor_params_show()
Sashiko noticed an out-of-bounds read [1].
In spi_nor_params_show(), the snor_f_names array is passed to
spi_nor_print_flags() using sizeof(snor_f_names).
Since snor_f_names is an array of pointers, sizeof() returns the total
number of bytes occupied by the pointers
(element_count * sizeof(void *))
rather than the element count itself. On 64-bit systems, this makes the
passed length 8x larger than intended.
Inside spi_nor_print_flags(), the 'names_len' argument is used to
bounds-check the 'names' array access. An out-of-bounds read occurs
if a flag bit is set that exceeds the array's actual element count
but is within the inflated byte-size count.
Correct this by using ARRAY_SIZE() to pass the actual number of
string pointers in the array.
📍 영향받는 시스템
Linux kernel (mtd: spi-nor driver components)
⚔️ 공격 벡터
로컬 공격자가 debugfs를 통해 특정 플래그를 설정하여 메모리 경계 외 데이터를 읽어내는 방식
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하거나, 해당 드라이버 코드를 ARRAY_SIZE()를 사용하도록 수정해야 합니다.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인합니다.