CVE-2024-26853

In the Linux kernel, the following vulnerability has been resolved: igc: avoid returning frame twice in XDP_REDIRECT When a frame can not be transmitted in XDP_REDIRECT (e.g. due to a full queue), it is necessary to free it by calling xdp_return_frame_rx_napi. However, this is the responsibility of the caller of the ndo_xdp_xmit (see for example bq_xmit_all in kernel/bpf/devmap.c) and thus calling it inside igc_xdp_xmit (which is the ndo_xdp_xmit of the igc driver) as well will lead to memory corruption. In fact, bq_xmit_all expects that it can return all frames after the last successfully transmitted one. Therefore, break for the first not transmitted frame, but do not call xdp_return_frame_rx_napi in igc_xdp_xmit. This is equally implemented in other Intel drivers such as the igb. There are two alternatives to this that were rejected: 1. Return num_frames as all the frames would have been transmitted and release them inside igc_xdp_xmit. While it might work technically, it is not what the return value is meant to represent (i.e. the number of SUCCESSFULLY transmitted packets). 2. Rework kernel/bpf/devmap.c and all drivers to support non-consecutively dropped packets. Besides being complex, it likely has a negative performance impact without a significant gain since it is anyway unlikely that the next frame can be transmitted if the previous one was dropped. The memory corruption can be reproduced with the following script which leads to a kernel panic after a few seconds. It basically generates more traffic than a i225 NIC can transmit and pushes it via XDP_REDIRECT from a virtual interface to the physical interface where frames get dropped. #!/bin/bash INTERFACE=enp4s0 INTERFACE_IDX=`cat /sys/class/net/$INTERFACE/ifindex` sudo ip link add dev veth1 type veth peer name veth2 sudo ip link set up $INTERFACE sudo ip link set up veth1 sudo ip link set up veth2 cat << EOF > redirect.bpf.c SEC("prog") int redirect(struct xdp_md *ctx) { return bpf_redirect($INTERFACE_IDX, 0); } char _license[] SEC("license") = "GPL"; EOF clang -O2 -g -Wall -target bpf -c redirect.bpf.c -o redirect.bpf.o sudo ip link set veth2 xdp obj redirect.bpf.o cat << EOF > pass.bpf.c SEC("prog") int pass(struct xdp_md *ctx) { return XDP_PASS; } char _license[] SEC("license") = "GPL"; EOF clang -O2 -g -Wall -target bpf -c pass.bpf.c -o pass.bpf.o sudo ip link set $INTERFACE xdp obj pass.bpf.o cat << EOF > trafgen.cfg { /* Ethernet Header */ 0xe8, 0x6a, 0x64, 0x41, 0xbf, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, const16(ETH_P_IP), /* IPv4 Header */ 0b01000101, 0, # IPv4 version, IHL, TOS const16(1028), # IPv4 total length (UDP length + 20 bytes (IP header)) const16(2), # IPv4 ident 0b01000000, 0, # IPv4 flags, fragmentation off 64, # IPv4 TTL 17, # Protocol UDP csumip(14, 33), # IPv4 checksum /* UDP Header */ 10, 0, 1, 1, # IP Src - adapt as needed 10, 0, 1, 2, # IP Dest - adapt as needed const16(6666), # UDP Src Port const16(6666), # UDP Dest Port const16(1008), # UDP length (UDP header 8 bytes + payload length) csumudp(14, 34), # UDP checksum /* Payload */ fill('W', 1000), } EOF sudo trafgen -i trafgen.cfg -b3000MB -o veth1 --cpp
Configurations

Configuration 1 (hide)

OR cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc3:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc4:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc5:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc6:*:*:*:*:*:*

History

02 Apr 2025, 13:17

Type Values Removed Values Added
CWE CWE-787
CVSS v2 : unknown
v3 : unknown
v2 : unknown
v3 : 5.5
References () https://git.kernel.org/stable/c/1b3b8231386a572bac8cd5b6fd7e944b84f9bb1f - () https://git.kernel.org/stable/c/1b3b8231386a572bac8cd5b6fd7e944b84f9bb1f - Patch
References () https://git.kernel.org/stable/c/63a3c1f3c9ecc654d851e7906d05334cd0c236e2 - () https://git.kernel.org/stable/c/63a3c1f3c9ecc654d851e7906d05334cd0c236e2 - Patch
References () https://git.kernel.org/stable/c/8df393af9e7e8dfd62e9c41dbaa4d2ff53bf794a - () https://git.kernel.org/stable/c/8df393af9e7e8dfd62e9c41dbaa4d2ff53bf794a - Patch
References () https://git.kernel.org/stable/c/ef27f655b438bed4c83680e4f01e1cde2739854b - () https://git.kernel.org/stable/c/ef27f655b438bed4c83680e4f01e1cde2739854b - Patch
First Time Linux linux Kernel
Linux
CPE cpe:2.3:o:linux:linux_kernel:6.8:rc6:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc5:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc4:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.8:rc3:*:*:*:*:*:*

21 Nov 2024, 09:03

Type Values Removed Values Added
Summary
  • (es) En el kernel de Linux se ha resuelto la siguiente vulnerabilidad: igc: evita devolver la trama dos veces en XDP_REDIRECT Cuando una trama no se puede transmitir en XDP_REDIRECT (por ejemplo, debido a una cola llena), es necesario liberarla llamando a xdp_return_frame_rx_napi. Sin embargo, esto es responsabilidad de quien llama a ndo_xdp_xmit (ver, por ejemplo, bq_xmit_all en kernel/bpf/devmap.c) y, por lo tanto, llamarlo dentro de igc_xdp_xmit (que es el ndo_xdp_xmit del controlador igc) también provocará daños en la memoria. De hecho, bq_xmit_all espera poder devolver todas las tramas después de la última transmitida con éxito. Por lo tanto, interrumpa el primer cuadro no transmitido, pero no llame a xdp_return_frame_rx_napi en igc_xdp_xmit. Esto se implementa igualmente en otros controladores Intel como el igb. Hay dos alternativas a esto que fueron rechazadas: 1. Devolver num_frames ya que se habrían transmitido todas las tramas y liberarlas dentro de igc_xdp_xmit. Si bien podría funcionar técnicamente, no es lo que debe representar el valor de retorno (es decir, el número de paquetes transmitidos CON ÉXITO). 2. Vuelva a trabajar kernel/bpf/devmap.c y todos los controladores para admitir paquetes descartados no consecutivos. Además de ser complejo, es probable que tenga un impacto negativo en el rendimiento sin una ganancia significativa, ya que de todos modos es poco probable que se pueda transmitir la siguiente trama si se eliminó la anterior. La corrupción de la memoria se puede reproducir con el siguiente script, lo que provoca un pánico en el kernel después de unos segundos. Básicamente, genera más tráfico del que puede transmitir una NIC i225 y lo envía a través de XDP_REDIRECT desde una interfaz virtual a la interfaz física donde se eliminan las tramas. #!/bin/bash INTERFACE=enp4s0 INTERFACE_IDX=`cat /sys/class/net/$INTERFACE/ifindex` sudo ip link agregar dev veth1 tipo veth nombre del par veth2 sudo ip link set up $INTERFACE sudo ip link set up veth1 sudo enlace ip configurado veth2 cat &lt;&lt; EOF &gt; redirección.bpf.c SEC("prog") int redirección(struct xdp_md *ctx) { return bpf_redirect($INTERFACE_IDX, 0); } char _license[] SEC("licencia") = "GPL"; EOF clang -O2 -g -Wall -target bpf -c redirección.bpf.c -o redirección.bpf.o sudo ip link set veth2 xdp obj redirección.bpf.o cat &lt;&lt; EOF &gt; pass.bpf.c SEC(" prog") int pass(struct xdp_md *ctx) { return XDP_PASS; } char _license[] SEC("licencia") = "GPL"; EOF clang -O2 -g -Wall -target bpf -c pass.bpf.c -o pass.bpf.o sudo ip link set $INTERFACE xdp obj pass.bpf.o cat &lt;&lt; EOF &gt; trafgen.cfg { /* Ethernet Encabezado */ 0xe8, 0x6a, 0x64, 0x41, 0xbf, 0x46, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, const16(ETH_P_IP), /* Encabezado IPv4 */ 0b01000101, 0, # Versión IPv4, IHL, TOS const16 (1028), # Longitud total de IPv4 (longitud UDP + 20 bytes (encabezado IP)) const16(2), # Identificador de IPv4 0b01000000, 0, # Banderas de IPv4, fragmentación desactivada 64, # IPv4 TTL 17, # Protocolo UDP csumip(14 , 33), # Suma de comprobación IPv4 /* Encabezado UDP */ 10, 0, 1, 1, # IP Src - adaptar según sea necesario 10, 0, 1, 2, # IP Dest - adaptar según sea necesario const16(6666), # UDP Puerto Src const16(6666), # Puerto de destino UDP const16(1008), # Longitud UDP (encabezado UDP 8 bytes + longitud de carga útil) csumudp(14, 34), # Suma de comprobación UDP /* Carga útil */ fill('W', 1000 ), } EOF sudo trafgen -i trafgen.cfg -b3000MB -o veth1 --cpp
References () https://git.kernel.org/stable/c/1b3b8231386a572bac8cd5b6fd7e944b84f9bb1f - () https://git.kernel.org/stable/c/1b3b8231386a572bac8cd5b6fd7e944b84f9bb1f -
References () https://git.kernel.org/stable/c/63a3c1f3c9ecc654d851e7906d05334cd0c236e2 - () https://git.kernel.org/stable/c/63a3c1f3c9ecc654d851e7906d05334cd0c236e2 -
References () https://git.kernel.org/stable/c/8df393af9e7e8dfd62e9c41dbaa4d2ff53bf794a - () https://git.kernel.org/stable/c/8df393af9e7e8dfd62e9c41dbaa4d2ff53bf794a -
References () https://git.kernel.org/stable/c/ef27f655b438bed4c83680e4f01e1cde2739854b - () https://git.kernel.org/stable/c/ef27f655b438bed4c83680e4f01e1cde2739854b -

17 Apr 2024, 12:48

Type Values Removed Values Added
New CVE

Information

Published : 2024-04-17 11:15

Updated : 2025-04-02 13:17


NVD link : CVE-2024-26853

Mitre link : CVE-2024-26853

CVE.ORG link : CVE-2024-26853


JSON object : View

Products Affected

linux

  • linux_kernel
CWE
CWE-787

Out-of-bounds Write