CVE-2024-26853

See a problem?
Source
https://nvd.nist.gov/vuln/detail/CVE-2024-26853
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-26853.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2024-26853
Related
Published
2024-04-17T11:15:08Z
Modified
2024-09-11T05:03:33.923888Z
Summary
[none]
Details

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 XDPREDIRECT (e.g. due to a full queue), it is necessary to free it by calling xdpreturnframerx_napi.

However, this is the responsibility of the caller of the ndoxdpxmit (see for example bqxmitall in kernel/bpf/devmap.c) and thus calling it inside igcxdpxmit (which is the ndoxdpxmit of the igc driver) as well will lead to memory corruption.

In fact, bqxmitall 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 xdpreturnframerxnapi in igcxdpxmit. This is equally implemented in other Intel drivers such as the igb.

There are two alternatives to this that were rejected: 1. Return numframes as all the frames would have been transmitted and release them inside igcxdp_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 xdpmd *ctx) { return bpfredirect($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 xdpmd *ctx) { return XDPPASS; }

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(ETHPIP),

 /* 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

References

Affected packages

Debian:12 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.1.82-1

Affected versions

6.*

6.1.27-1
6.1.37-1
6.1.38-1
6.1.38-2~bpo11+1
6.1.38-2
6.1.38-3
6.1.38-4~bpo11+1
6.1.38-4
6.1.52-1
6.1.55-1~bpo11+1
6.1.55-1
6.1.64-1
6.1.66-1
6.1.67-1
6.1.69-1~bpo11+1
6.1.69-1
6.1.76-1~bpo11+1
6.1.76-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.7.12-1

Affected versions

6.*

6.1.27-1
6.1.37-1
6.1.38-1
6.1.38-2~bpo11+1
6.1.38-2
6.1.38-3
6.1.38-4~bpo11+1
6.1.38-4
6.1.52-1
6.1.55-1~bpo11+1
6.1.55-1
6.1.64-1
6.1.66-1
6.1.67-1
6.1.69-1~bpo11+1
6.1.69-1
6.1.76-1~bpo11+1
6.1.76-1
6.1.82-1
6.1.85-1
6.1.90-1~bpo11+1
6.1.90-1
6.1.94-1~bpo11+1
6.1.94-1
6.1.98-1
6.1.99-1
6.1.106-1
6.1.106-2
6.1.106-3
6.3.1-1~exp1
6.3.2-1~exp1
6.3.4-1~exp1
6.3.5-1~exp1
6.3.7-1~bpo12+1
6.3.7-1
6.3.11-1
6.4~rc6-1~exp1
6.4~rc7-1~exp1
6.4.1-1~exp1
6.4.4-1~bpo12+1
6.4.4-1
6.4.4-2
6.4.4-3~bpo12+1
6.4.4-3
6.4.11-1
6.4.13-1
6.5~rc4-1~exp1
6.5~rc6-1~exp1
6.5~rc7-1~exp1
6.5.1-1~exp1
6.5.3-1~bpo12+1
6.5.3-1
6.5.6-1
6.5.8-1
6.5.10-1~bpo12+1
6.5.10-1
6.5.13-1
6.6.3-1~exp1
6.6.4-1~exp1
6.6.7-1~exp1
6.6.8-1
6.6.9-1
6.6.11-1
6.6.13-1~bpo12+1
6.6.13-1
6.6.15-1
6.6.15-2
6.7-1~exp1
6.7.1-1~exp1
6.7.4-1~exp1
6.7.7-1
6.7.9-1
6.7.9-2
6.7.12-1~bpo12+1

Ecosystem specific

{
    "urgency": "not yet assigned"
}