🇰🇷 한글 설명
Linux 커널 ksmbd 모듈의 krb5_authenticate() 함수에서 SMB2_SESSION_SETUP이 복합(compound) SMB2 요청의 중간 요소로 처리될 때, 이전 응답들의 누적 크기를 고려하지 않아 out_len이 실제보다 크게 계산됩니다. 이로 인해 AP-REP 토큰 복사 시 response_buf 범위를 넘어 인접 커널 힙 메모리에 쓰기가 발생할 수 있으며, 수정은 work->next_smb2_rsp_hdr_off를 차감하여 실제 남은 버퍼 공간을 정확히 계산하는 것입니다.
💡 쉬운 설명
Linux 커널의 파일 공유 기능(ksmbd) 인증 처리 과정에서 응답 버퍼의 남은 공간을 잘못 계산하는 결함입니다. 이로 인해 데이터가 버퍼 바깥의 커널 메모리를 덮어쓸 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix heap out-of-bounds write in krb5_authenticate()
In krb5_authenticate(), out_len is calculated to determine available
headroom in response_buf for the incoming Kerberos AP-REP token. However,
when SMB2_SESSION_SETUP is processed as a non-first element of a compounded
SMB2 request, the calculation omits work->next_smb2_rsp_hdr_off.
This causes out_len to overstate remaining buffer headroom by
the cumulative size of prior responses in the compound chain. Consequently,
the length check in ksmbd_krb5_authenticate()
(*out_len <= resp->spnego_blob_len) passes erroneously, allowing memcpy()
to write the AP-REP blob past the end of response_buf into adjacent kernel
heap memory.
Fix this by subtracting work->next_smb2_rsp_hdr_off when computing out_len,
ensuring it accurately reflects physical remaining buffer space.
📍 영향받는 시스템
ksmbd 모듈을 사용하는 Linux 커널 (수정 커밋 적용 전 버전)
⚔️ 공격 벡터
인증되지 않았거나 낮은 권한의 원격 공격자가 조작된 복합 SMB2 요청을 보내 커널 힙 메모리를 손상시키고 권한 상승 또는 시스템 불안정을 유발할 수 있습니다.
🛡️ 대응 방법
배포판의 최신 커널로 업데이트하거나 해당 수정 패치가 포함된 커널을 적용하고, 필요시 ksmbd 서비스를 비활성화하십시오.
🔧 검증 코드
커널 버전을 확인해 최신 패치 배포판과 비교하고, ksmbd 모듈이 로드되어 있지 않다면 이 취약점의 영향을 받지 않습니다.
uname -r && (lsmod | grep -i ksmbd || echo 'ksmbd not loaded')