🇰🇷 한글 설명
Linux 커널의 ksmbd 모듈에서 smb2_get_ea() 함수가 EA(Extended Attribute) 정렬을 위해 memset()을 수행할 때 경계 검사를 누락하여 발생하는 Out-of-bounds write 취약점입니다. 데이터가 버퍼의 남은 공간을 정확히 채울 경우, 정렬을 위한 패딩 작업이 할당된 메모리 범위를 넘어 인접한 커널 힙 메모리를 덮어쓸 수 있습니다.
💡 쉬운 설명
파일의 추가 정보를 처리하는 과정에서 데이터 크기를 맞추기 위해 빈 공간을 채우다가, 정해진 메모리 범위를 넘어서 데이터를 쓰는 오류입니다. 이로 인해 시스템의 중요한 메모리 영역이 오염되어 보안 위협이 발생할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix out-of-bounds write in smb2_get_ea() EA alignment
smb2_get_ea() applies 4-byte alignment padding via memset() after
writing each EA entry. The bounds check on buf_free_len is performed
before the value memcpy, but the alignment memset fires unconditionally
afterward with no check on remaining space.
When the EA value exactly fills the remaining buffer (buf_free_len == 0
after value subtraction), the alignment memset writes 1-3 NUL bytes
past the buf_free_len boundary. In compound requests where the response
buffer is shared across commands, the first command (e.g., READ) can
consume most of the buffer, leaving a tight remainder for the QUERY_INFO
EA response. The alignment memset then overwrites past the physical
kvmalloc allocation into adjacent kernel heap memory.
Add a bounds check before the alignment memset to ensure buf_free_len
can accommodate the padding bytes.
This is the same bug pattern fixed by commit beef2634f81f ("ksmbd: fix
potencial OOB in get_file_all_info() for compound requests") and
commit fda9522ed6af ("ksmbd: fix OOB write in QUERY_INFO for compound
requests"), both of which added bounds checks before unconditional
writes in QUERY_INFO response handlers.
📍 영향받는 시스템
ksmbd 모듈을 사용하는 Linux 커널 버전
⚔️ 공격 벡터
악의적으로 조작된 SMB2 EA(Extended Attribute) 응답을 포함한 복합 요청(Compound Request)을 전송하여 커널 힙 메모리 오버플로우 유도
🛡️ 대응 방법
ksmbd의 smb2_get_ea() 함수에 패딩 쓰기 전 남은 공간을 확인하는 경계 검사 로직이 포함된 최신 커널로 업데이트
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 패치가 적용된 버전인지 확인