🇰🇷 한글 설명
Linux 커널의 SMB 클라이언트가 심볼릭 링크 에러 응답을 파싱할 때 범위 검사가 불완전하여 Out-of-bounds 메모리 읽기가 발생합니다. 악의적인 SMB 서버가 crafted된 응답을 전송하면 힙 메모리의 바이트가 유출될 수 있습니다.
💡 쉬운 설명
리눅스가 네트워크 파일 서버와 통신할 때 메모리 범위를 제대로 확인하지 않아 민감 정보가 노출될 수 있습니다. 악의적인 서버가 이를 이용하여 시스템 메모리의 비밀 데이터를 훔칠 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
smb: client: fix OOB reads parsing symlink error response
When a CREATE returns STATUS_STOPPED_ON_SYMLINK, smb2_check_message()
returns success without any length validation, leaving the symlink
parsers as the only defense against an untrusted server.
symlink_data() walks SMB 3.1.1 error contexts with the loop test "p <
end", but reads p->ErrorId at offset 4 and p->ErrorDataLength at offset
0. When the server-controlled ErrorDataLength advances p to within 1-7
bytes of end, the next iteration will read past it. When the matching
context is found, sym->SymLinkErrorTag is read at offset 4 from
p->ErrorContextData with no check that the symlink header itself fits.
smb2_parse_symlink_response() then bounds-checks the substitute name
using SMB2_SYMLINK_STRUCT_SIZE as the offset of PathBuffer from
iov_base. That value is computed as sizeof(smb2_err_rsp) +
sizeof(smb2_symlink_err_rsp), which is correct only when
ErrorContextCount == 0.
With at least one error context the symlink data sits 8 bytes deeper,
and each skipped non-matching context shifts it further by 8 +
ALIGN(ErrorDataLength, 8). The check is too short, allowing the
substitute name read to run past iov_len. The out-of-bound heap bytes
are UTF-16-decoded into the symlink target and returned to userspace via
readlink(2).
Fix this all up by making the loops test require the full context header
to fit, rejecting sym if its header runs past end, and bound the
substitute name against the actual position of sym->PathBuffer rather
than a fixed offset.
Because sub_offs and sub_len are 16bits, the pointer math will not
overflow here with the new greater-than.
📍 영향받는 시스템
SMB 3.1.1을 지원하는 Linux 커널 (CIFS 클라이언트 활성화 시)
⚔️ 공격 벡터
신뢰할 수 없는 SMB 서버가 crafted된 CREATE response를 전송하여 OOB 읽기 발생
🛡️ 대응 방법
Linux 커널 패치 적용 또는 신뢰할 수 없는 SMB 서버로의 연결 제한
🔧 검증 코드
커널 버전 확인 후 CIFS 모듈 로드 여부를 확인하고, 패치된 버전으로 업데이트 필요 판단
uname -r && lsmod | grep cifs