Descripción
En el kernel de Linux se resolvió la siguiente vulnerabilidad: IB/isert: rechazar PDU que declaran más datos de los recibidos isert_recv_done() entrega cada PDU recibida a los controladores de opcode sin revisar nunca wc->byte_len, la cantidad de bytes que el HCA realmente colocó en el descriptor de recepción. Luego, los controladores copian esa cantidad de bytes (la longitud del segmento de datos que el iniciador declaró en el BHS, ntoh24(hdr->dlength), mediante los valores derivados unsol_data_len / imm_data_len) desde el descriptor de tamaño fijo: isert_handle_iscsi_dataout(): sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc), unsol_data_len); isert_handle_scsi_cmd(): sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents, isert_get_data(rx_desc), imm_data_len); Como la longitud declarada nunca se compara con wc->byte_len, un iniciador puede declarar un segmento de datos mayor que los bytes que realmente envió (y mayor que el descriptor) y provocar una lectura fuera de límites del búfer de recepción. Nada antes de isert cierra esta vía: - __iscsit_check_dataout_hdr() limita la carga útil entrante según conn_ops->MaxXmitDataSegmentLength (MXDSL), un parámetro de transmisión que aquí se usa para la verificación de entrada. - iscsi_set_connection_parameters() establece ops->MaxXmitDataSegmentLength = ops->TargetRecvDataSegmentLength; y TARGETRECVDATASEGMENTLENGTH no figura en la lista de limitación con min() en iscsi_check_acceptor_state(), por lo que el valor que declara el iniciador se adopta tal cual (rango del tipo 512..16777215). En la práctica, el iniciador eleva su propio límite. - isert nunca limita el valor negociado a su propio descriptor de recepción de tamaño fijo (ISER_RX_SIZE, 9216 bytes), por lo que el límite del núcleo del target y el tamaño del descriptor no están relacionados. La ruta imm_data_len == data_len es más que una sobrelectura: crea un alias del descriptor de recepción mediante sg_set_buf() y lo pasa al backend como fuente de datos del SCSI WRITE, de modo que una longitud declarada en exceso hace que contenido del heap más allá del descriptor se escriba a través del backend en el almacenamiento subyacente. El backend es víctima de la scatterlist sobredimensionada que isert le entrega, no la causa; no se demostró la lectura posterior de los bytes escritos. Activación: una vez completado el inicio de sesión (fase de funcionalidad completa), un iniciador que ha declarado un TargetRecvDataSegmentLength grande y un FirstBurstLength que permite datos no solicitados/inmediatos envía una PDU cuya longitud de segmento de datos declarada excede lo recibido. Con KASAN: BUG: KASAN: slab-out-of-bounds in sg_copy_buffer+0x150/0x1c0 Read of size 4096 at addr ffff888109720800 by task kworker/1:0H/25 Workqueue: ib-comp-wq ib_cq_poll_work Call Trace: sg_copy_buffer+0x150/0x1c0 isert_recv_done+0xba6/0x2390 __ib_process_cq+0xe1/0x390 ib_cq_poll_work+0x46/0x150 isert_recv_done+0xba6 corresponde a isert_handle_iscsi_dataout() (ib_isert.c:1160), integrada en línea a través de isert_rx_opcode(). Se valida wc->byte_len frente a la estructura de la trama en isert_recv_done() antes de que la PDU llegue a cualquier controlador, y se restablece la conexión si es corta. Como la comparación no resta la longitud del encabezado, también rechaza PDU más cortas que los encabezados iSER e iSCSI, que de otro modo se analizarían a partir de contenido obsoleto del descriptor. El controlador de inicio de sesión rechaza PDU más cortas que ISER_HEADERS_LEN (commit 29e7b925ae6d ("IB/isert: Reject login PDUs shorter than ISER_HEADERS_LEN")), pero tampoco limita la longitud declarada; eso se corrige en el siguiente parche. Los controladores de datos no tenían ninguna verificación de longitud. isert lee el segmento de datos desde un desplazamiento fijo: isert_get_data() devuelve el encabezado iSER más ISER_HEADERS_LEN y no hace ningún ajuste por un AHS. Por lo tanto, los bytes que tocan los controladores son exactamente [ISER_HEADERS_LEN, ISER_HEADERS_LEN + dlength), y comparar esa suma con wc->byte_len limita precisamente la región que se lee. Un término AHS solo haría la prueba más estricta sin limitar nada más ---truncado---
Qué hacer
Revisa si usas el producto afectado y en qué versión, y aplica la actualización o la mitigación que indique el aviso del fabricante. CISA no ha confirmado que se esté explotando; si eso cambia, esta ficha pasa a «explotada» y te avisamos en el boletín.
Versiones afectadas
- Linux Afectadas: b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a b4706722ed3ea72882b3c986a19b4a1ba66384c4 · b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a bc58e9d3dc560220c57b8bdfc12af0cff1c8a43d · b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a 274b1ad7e78338710864c4b4235bb1ce7e7107f9 · b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a 2a6b8f88fb7ee51714a1922a039225bdcaf12855 · b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a 39da0b7e1f530347d284cebcfc5b5afa90a173bf · b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a cf36fa5357a2fb25776a568d13a3653da7d99bcb · b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a 352dc85324b29f5c85876f2666f3158b645e3f18 · b8d26b3be8b33682cf163274ed07479a70554633 y anteriores a 957f92ea4022fb6af4618271615a2a21a7b5bef9
- Linux Afectadas: 3.10 No afectadas: 5.10.270 · 5.15.221 · 6.1.188 · 6.6.157 · 6.12.110 · 6.18.52
Según el registro de la vulnerabilidad en CVE.org, tal como lo publicó el fabricante. Confirma tu versión exacta en el aviso del fabricante.
Referencias
- Referencia en git.kernel.orggit.kernel.org/stable/c/b4706722ed3ea72882b3c986a19b4a1ba66384c4
- Referencia en git.kernel.orggit.kernel.org/stable/c/bc58e9d3dc560220c57b8bdfc12af0cff1c8a43d
- Referencia en git.kernel.orggit.kernel.org/stable/c/274b1ad7e78338710864c4b4235bb1ce7e7107f9
- Referencia en git.kernel.orggit.kernel.org/stable/c/2a6b8f88fb7ee51714a1922a039225bdcaf12855
- Referencia en git.kernel.orggit.kernel.org/stable/c/39da0b7e1f530347d284cebcfc5b5afa90a173bf
- Referencia en git.kernel.orggit.kernel.org/stable/c/cf36fa5357a2fb25776a568d13a3653da7d99bcb
- Referencia en git.kernel.orggit.kernel.org/stable/c/352dc85324b29f5c85876f2666f3158b645e3f18
- Referencia en git.kernel.orggit.kernel.org/stable/c/957f92ea4022fb6af4618271615a2a21a7b5bef9
Ver el texto original en inglés (CVE.org)
IB/isert: reject PDUs declaring more data than was received
In the Linux kernel, the following vulnerability has been resolved: IB/isert: reject PDUs declaring more data than was received isert_recv_done() hands each received PDU to the opcode handlers without ever looking at wc->byte_len, the number of bytes the HCA actually placed in the receive descriptor. The handlers then copy that many bytes - the data-segment length the initiator declared in the BHS (ntoh24(hdr->dlength), via the derived unsol_data_len / imm_data_len) - out of the fixed-size descriptor: isert_handle_iscsi_dataout(): sg_copy_from_buffer(sg_start, sg_nents, isert_get_data(rx_desc), unsol_data_len); isert_handle_scsi_cmd(): sg_copy_from_buffer(cmd->se_cmd.t_data_sg, sg_nents, isert_get_data(rx_desc), imm_data_len); Because the declared length is never checked against wc->byte_len, an initiator can declare a data segment larger than the bytes it actually sent (and larger than the descriptor) and cause an out-of-bounds read of the receive buffer. Nothing upstream of isert closes this door: - __iscsit_check_dataout_hdr() bounds the inbound payload against conn_ops->MaxXmitDataSegmentLength (MXDSL) - a transmit parameter, used here for the inbound check. - iscsi_set_connection_parameters() sets ops->MaxXmitDataSegmentLength = ops->TargetRecvDataSegmentLength; and TARGETRECVDATASEGMENTLENGTH is absent from the min()-clamp list in iscsi_check_acceptor_state(), so the value the initiator declares is adopted verbatim (type range 512..16777215). The initiator effectively raises its own ceiling. - isert never clamps the negotiated value to its own fixed receive descriptor (ISER_RX_SIZE, 9216 bytes), so the target core's bound and the descriptor size are unrelated. The imm_data_len == data_len path is more than an over-read: it aliases the receive descriptor via sg_set_buf() and passes it to the backend as the data source for the SCSI WRITE, so an over-declared length causes heap contents past the descriptor to be written through the backend to the backing store. The backend is the victim of the oversized scatterlist isert hands it, not the cause; no read-back of the written bytes was demonstrated. Trigger: after login completes (full feature phase), an initiator that has declared a large TargetRecvDataSegmentLength and a FirstBurstLength that permits unsolicited/immediate data sends a PDU whose declared data-segment length exceeds what was received. With KASAN: BUG: KASAN: slab-out-of-bounds in sg_copy_buffer+0x150/0x1c0 Read of size 4096 at addr ffff888109720800 by task kworker/1:0H/25 Workqueue: ib-comp-wq ib_cq_poll_work Call Trace: sg_copy_buffer+0x150/0x1c0 isert_recv_done+0xba6/0x2390 __ib_process_cq+0xe1/0x390 ib_cq_poll_work+0x46/0x150 isert_recv_done+0xba6 resolves to isert_handle_iscsi_dataout() (ib_isert.c:1160), inlined through isert_rx_opcode(). Validate wc->byte_len against the framing in isert_recv_done() before the PDU reaches any handler, and reinstate the connection if it is short. Because the test compares without subtracting the header length, it also rejects PDUs shorter than the iSER and iSCSI headers, which would otherwise be parsed out of stale descriptor contents. The login handler rejects PDUs shorter than ISER_HEADERS_LEN (commit 29e7b925ae6d ("IB/isert: Reject login PDUs shorter than ISER_HEADERS_LEN")) but does not bound the declared length either; that is fixed in the next patch. The data handlers had no length check at all. isert reads the data segment from a fixed offset: isert_get_data() returns the iSER header plus ISER_HEADERS_LEN and makes no adjustment for an AHS. The bytes the handlers touch are therefore exactly [ISER_HEADERS_LEN, ISER_HEADERS_LEN + dlength), and comparing that sum against wc->byte_len bounds precisely the region that is read. An AHS term would only make the test stricter without bounding anything furth ---truncated---