Descripción
En el kernel de Linux, se resolvió la siguiente vulnerabilidad: nfsd: preflight SEQUENCE replies before accepting a slot nfsd4_sequence() reduce el búfer de respuesta al límite de respuesta en caché de la sesión antes de aceptar el seqid del slot. Un cliente puede negociar ca_maxresponsesize_cached hasta NFSD_MIN_HDR_SEQ_SZ, y entonces nfsd4_alloc_slot() asigna a cada slot un sl_data[] de longitud cero. Una etiqueta COMPOUND puede llenar ese búfer reducido hasta que contenga el opcode SEQUENCE, pero no la palabra de estado que le sigue. nfsd4_encode_operation() retorna sin ejecutar nfsd4_encode_sequence(), por lo que cstate.data_offset permanece en cero. También deja op->status en nfs_ok, por lo que el COMPOUND se trata como exitoso. nfsd4_store_cache_entry() se niega a almacenar en caché un SEQUENCE aislado que devolvió un error. Esa prueba lee el estado informado por la operación, por lo que aquí se supera. La copia comienza en el desplazamiento cero y toma la respuesta completa, incluidos los encabezados RPC y COMPOUND, hacia el sl_data[] de longitud cero. La etiqueta COMPOUND se copia junto con ella, por lo que el cliente elige la mayoría de los bytes escritos más allá del final del slot: BUG: KASAN: slab-out-of-bounds in read_bytes_from_xdr_buf+0x1bc/0x390 Write of size 80 at addr ffff888003a549cd by task kunit_try_catch/24 __asan_memcpy+0x38/0x60 read_bytes_from_xdr_buf+0x1bc/0x390 nfsd4_sequence_done+0x5b0/0x810 nfs4svc_encode_compoundres+0x1bf/0x240 La corrección verifica que el resultado de SEQUENCE de tamaño fijo, más espacio para el estado de error de una operación siguiente, quepa en el límite negociado antes de reducir el búfer y consumir el seqid del slot. El slot y su caché de respuestas quedan sin cambios, como exige RFC 8881 Section 2.10.6.1.2 para un error devuelto por SEQUENCE.
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: 47ee52986472dba068e8223cbaf1b65d74238781 y anteriores a 1a5a227bca6a8a9f9d31230697aeb84c62a21da6 · 47ee52986472dba068e8223cbaf1b65d74238781 y anteriores a 37fc2ec211630360e9aefcaaec8730db964645f2 · 47ee52986472dba068e8223cbaf1b65d74238781 y anteriores a ed98b0c57e5e84290c5b35428144ab26778905f3 · 47ee52986472dba068e8223cbaf1b65d74238781 y anteriores a 35ff1a7a7e3835c3e974bc5c45d335897564ceae
- Linux Afectadas: 3.16 No afectadas: 6.12.117 · 6.18.61 · 7.3.2 · 7.4-rc1
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/1a5a227bca6a8a9f9d31230697aeb84c62a21da6
- Referencia en git.kernel.orggit.kernel.org/stable/c/37fc2ec211630360e9aefcaaec8730db964645f2
- Referencia en git.kernel.orggit.kernel.org/stable/c/ed98b0c57e5e84290c5b35428144ab26778905f3
- Referencia en git.kernel.orggit.kernel.org/stable/c/35ff1a7a7e3835c3e974bc5c45d335897564ceae
Ver el texto original en inglés (CVE.org)
nfsd: preflight SEQUENCE replies before accepting a slot
In the Linux kernel, the following vulnerability has been resolved: nfsd: preflight SEQUENCE replies before accepting a slot nfsd4_sequence() narrows the reply buffer to the session's cached reply limit before it accepts the slot seqid. A client may negotiate ca_maxresponsesize_cached down to NFSD_MIN_HDR_SEQ_SZ, and nfsd4_alloc_slot() then gives every slot a zero-length sl_data[]. A COMPOUND tag can fill that narrowed buffer until it holds the SEQUENCE opcode but not the status word that follows. nfsd4_encode_operation() returns without running nfsd4_encode_sequence(), so cstate.data_offset stays zero. It leaves op->status at nfs_ok as well, so the COMPOUND is treated as having succeeded. nfsd4_store_cache_entry() declines to cache a lone SEQUENCE that returned an error. That test reads the status the operation reported, so it passes here. The copy starts at offset zero and takes the whole reply, RPC and COMPOUND headers included, into the zero-length sl_data[]. The COMPOUND tag is copied along with it, so the client picks most of the bytes written past the end of the slot: BUG: KASAN: slab-out-of-bounds in read_bytes_from_xdr_buf+0x1bc/0x390 Write of size 80 at addr ffff888003a549cd by task kunit_try_catch/24 __asan_memcpy+0x38/0x60 read_bytes_from_xdr_buf+0x1bc/0x390 nfsd4_sequence_done+0x5b0/0x810 nfs4svc_encode_compoundres+0x1bf/0x240 Check that the fixed-size SEQUENCE result, plus room for a following operation's error status, fits the negotiated limit before narrowing the buffer and consuming the slot seqid. The slot and its reply cache are left unchanged, as RFC 8881 Section 2.10.6.1.2 requires of an error returned from SEQUENCE.