CVE-2024-41010: bpf: Fix too early release of tcx_entry

Published Jul 17, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix too early release of tcxentry

Pedro Pinto and later independently also Hyunwoo Kim and Wongi Lee reported an issue that the tcxentry can be released too early leading to a use after free (UAF) when an active old-style ingress or clsact qdisc with a shared tc block is later replaced by another ingress or clsact instance.

Essentially, the sequence to trigger the UAF (one example) can be as follows:

1. A network namespace is created 2. An ingress qdisc is created. This allocates a tcxentry, and &tcxentry->miniq is stored in the qdisc's miniqp->pminiq. At the same time, a tcf block with index 1 is created. 3. chain0 is attached to the tcf block. chain0 must be connected to the block linked to the ingress qdisc to later reach the function tcfchain0headchangecbdel() which triggers the UAF. 4. Create and graft a clsact qdisc. This causes the ingress qdisc created in step 1 to be removed, thus freeing the previously linked tcxentry:

rtnetlinkrcvmsg() => tcmodifyqdisc() => qdisccreate() => clsactinit() [a] => qdiscgraft() => qdiscdestroy() => qdiscdestroy() => ingressdestroy() [b] => tcxentryfree() => kfreercu() // tcxentry freed

5. Finally, the network namespace is closed. This registers the cleanupnet worker, and during the process of releasing the remaining clsact qdisc, it accesses the tcxentry that was already freed in step 4, causing the UAF to occur:

cleanupnet() => opsexitlist() => defaultdeviceexitbatch() => unregisternetdevicemany() => unregisternetdevicemanynotify() => devshutdown() => qdiscput() => clsactdestroy() [c] => tcfblockputext() => tcfchain0headchangecbdel() => tcfchainheadchangeitem() => clsactchainheadchange() => miniqdiscpairswap() // UAF

There are also other variants, the gist is to add an ingress (or clsact) qdisc with a specific shared block, then to replace that qdisc, waiting for the tcxentry kfreercu() to be executed and subsequently accessing the current active qdisc's miniq one way or another.

The correct fix is to turn the miniqactive boolean into a counter. What can be observed, at step 2 above, the counter transitions from 0->1, at step [a] from 1->2 (in order for the miniq object to remain active during the replacement), then in [b] from 2->1 and finally [c] 1->0 with the eventual release. The reference counter in general ranges from [0,2] and it does not need to be atomic since all access to the counter is protected by the rtnl mutex. With this in place, there is no longer a UAF happening and the tcxentry is freed at the correct time.

Other sources

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix too early release of tcxentry

The Linux kernel CVE team has assigned CVE-2024-41010 to this issue.

Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024071718-CVE-2024-41010-9042@gregkh/T

Red Hat

Affected Software

4 affected componentsFixes available
Linux Linux kernel>=6.6<6.6.41
Linux Linux kernel>=6.7<6.9.10
debian/linux
5.10.223-15.10.234-16.1.129-16.1.135-16.12.22-16.12.25-1
redhat/kernel<6.10
6.10

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.22-1Fixed in 6.12.25-1
  2. Upgrade

    Upgrade redhat/kernel to a version that resolves this vulnerability.

    Fixed in 6.10
  3. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch CVE-2024-41010
  4. Configuration

    Apply the fix that turns the miniq_active boolean into a reference counter for tcx_entry (miniq object in qdisc miniqp->p_miniq), so tcx_entry is not released too early; ensure counter accesses are protected by the rtnl mutex (no need for atomic).

    Linux kernel bpf tcx_entry lifetime management miniq_active = convert boolean to counter with transitions 0->1, 1->2, 2->1, 1->0 protected by rtnl mutex

Event History

Jul 17, 2024
CVE Published
via MITRE·06:10 AM
Data Sourced
via MITRE·06:10 AM
DescriptionSeverity
Data Sourced
via NVD·07:15 AM
RemedyDescriptionSeverityWeaknessAffected Software
Dec 19, 2024
Data Sourced
via Ubuntu·12:31 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2024-41010?

CVE-2024-41010 has a moderate severity rating due to the potential for a use after free vulnerability in the Linux kernel.

2

Which versions of the Linux kernel are affected by CVE-2024-41010?

CVE-2024-41010 affects specific versions of the Linux kernel including those between 6.7 and 6.9.10 and those between 6.6 and 6.6.41.

3

How do I fix CVE-2024-41010?

To fix CVE-2024-41010, upgrade your Linux kernel to versions 5.10.223-1, 5.10.226-1, 6.1.119-1, 6.1.123-1, 6.12.10-1, or 6.12.11-1.

4

What is a use after free vulnerability related to CVE-2024-41010?

A use after free vulnerability occurs when a program continues to use a memory resource after it has been freed, potentially leading to program crashes or security breaches.

5

Who reported CVE-2024-41010?

CVE-2024-41010 was reported by Pedro Pinto, Hyunwoo Kim, and Wongi Lee.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203