🇰🇷 한글 설명
Linux 커널의 SCSI iSCSI 타겟 구현에서 발생하는 힙 버퍼 오버플로 취약점입니다. iscsi_encode_text_output() 함수가 버퍼 용량을 확인하지 않고 데이터를 결합하여, 8KB 크기의 버퍼에 최대 32KB의 데이터를 써넣음으로써 메모리 오염을 유발할 수 있습니다.
💡 쉬운 설명
컴퓨터가 정보를 저장할 때 정해진 그릇보다 훨씬 많은 양의 데이터를 억지로 밀어 넣어 시스템을 고장 내거나 해킹할 수 있는 문제입니다. 공격자가 특수하게 조작된 로그인 요청을 보내면 시스템의 메모리 영역을 침범할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
scsi: target: iscsi: Bound iscsi_encode_text_output() appends to rsp_buf
iscsi_encode_text_output() concatenates "key=value\0" records into
login->rsp_buf, an 8192-byte kzalloc(MAX_KEY_VALUE_PAIRS) buffer
allocated in iscsit_alloc_login_setup_buffer(). The three sprintf() call
sites in this function (lines 1398, 1411, 1424 in v7.1-rc2) never check
the remaining buffer capacity:
*length += sprintf(output_buf, "%s=%s", er->key, er->value);
*length += 1;
output_buf = textbuf + *length;
The 8192-byte ceiling at iscsi_target_check_login_request() bounds the
*input* Login PDU payload, but a single PDU can carry up to 2048 minimal
four-byte "a=b\0" pairs, each unknown key expanding to a 16-byte
"a=NotUnderstood\0" output record via iscsi_add_notunderstood_response().
2048 * 16 = 32 KiB of output into an 8 KiB buffer, producing a ~24 KiB
heap overrun in the kmalloc-8k slab.
The fix introduces a static iscsi_encode_text_record() helper that uses
snprintf() with a per-call bounds check against the remaining buffer,
and threads a u32 textbuf_size parameter through
iscsi_encode_text_output(). Both call sites in
iscsi_target_handle_csg_zero() (PHASE_SECURITY) and
iscsi_target_handle_csg_one() (PHASE_OPERATIONAL) pass
MAX_KEY_VALUE_PAIRS. On overflow the encoder logs the condition, calls
iscsi_release_extra_responses() to drop queued records, and returns -1;
both caller sites now emit ISCSI_STATUS_CLS_INITIATOR_ERR /
ISCSI_LOGIN_STATUS_INIT_ERR via iscsit_tx_login_rsp() before returning,
so the initiator sees an explicit failed-login response rather than a
silent connection drop. (Prior to this patch only the PHASE_OPERATIONAL
caller did that; the PHASE_SECURITY caller is converted to the same
shape.)
📍 영향받는 시스템
Linux Kernel (v7.1-rc2 및 관련 iSCSI 타겟 구현 포함 버전)
⚔️ 공격 벡터
조작된 iSCSI Login PDU 페이로드를 전송하여 대량의 'NotUnderstood' 응답을 유도함으로써 힙 오버플로 발생
🛡️ 대응 방법
커널을 최신 보안 패치가 적용된 버전으로 업데이트하고, snprintf() 및 버퍼 크기 검증 로직이 포함된 패치를 적용해야 함
🔧 검증 코드
출력된 커널 버전이 취약점이 해결된 패치 버전 이후인지 확인하십시오.