CVE-2024-35854: mlxsw: spectrum_acl_tcam: Fix possible use-after-free during rehash
In the Linux kernel, the following vulnerability has been resolved:
mlxsw: spectrum_acl_tcam: Fix possible use-after-free during rehash
The rehash delayed work migrates filters from one region to another
according to the number of available credits.
The migrated from region is destroyed at the end of the work if the
number of credits is non-negative as the assumption is that this is
indicative of migration being complete. This assumption is incorrect as
a non-negative number of credits can also be the result of a failed
migration.
The destruction of a region that still has filters referencing it can
result in a use-after-free [1].
Fix by not destroying the region if migration failed.
[1]
BUG: KASAN: slab-use-after-free in mlxsw_sp_acl_ctcam_region_entry_remove+0x21d/0x230
Read of size 8 at addr ffff8881735319e8 by task kworker/0:31/3858
CPU: 0 PID: 3858 Comm: kworker/0:31 Tainted: G W 6.9.0-rc2-custom-00782-gf2275c2157d8 #5
Hardware name: Mellanox Technologies Ltd. MSN3700/VMOD0005, BIOS 5.11 01/06/2019
Workqueue: mlxsw_core mlxsw_sp_acl_tcam_vregion_rehash_work
Call Trace:
<TASK>
dump_stack_lvl+0xc6/0x120
print_report+0xce/0x670
kasan_report+0xd7/0x110
mlxsw_sp_acl_ctcam_region_entry_remove+0x21d/0x230
mlxsw_sp_acl_ctcam_entry_del+0x2e/0x70
mlxsw_sp_acl_atcam_entry_del+0x81/0x210
mlxsw_sp_acl_tcam_vchunk_migrate_all+0x3cd/0xb50
mlxsw_sp_acl_tcam_vregion_rehash_work+0x157/0x1300
process_one_work+0x8eb/0x19b0
worker_thread+0x6c9/0xf70
kthread+0x2c9/0x3b0
ret_from_fork+0x4d/0x80
ret_from_fork_asm+0x1a/0x30
</TASK>
Allocated by task 174:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
__kasan_kmalloc+0x8f/0xa0
__kmalloc+0x19c/0x360
mlxsw_sp_acl_tcam_region_create+0xdf/0x9c0
mlxsw_sp_acl_tcam_vregion_rehash_work+0x954/0x1300
process_one_work+0x8eb/0x19b0
worker_thread+0x6c9/0xf70
kthread+0x2c9/0x3b0
ret_from_fork+0x4d/0x80
ret_from_fork_asm+0x1a/0x30
Freed by task 7:
kasan_save_stack+0x33/0x60
kasan_save_track+0x14/0x30
kasan_save_free_info+0x3b/0x60
poison_slab_object+0x102/0x170
__kasan_slab_free+0x14/0x30
kfree+0xc1/0x290
mlxsw_sp_acl_tcam_region_destroy+0x272/0x310
mlxsw_sp_acl_tcam_vregion_rehash_work+0x731/0x1300
process_one_work+0x8eb/0x19b0
worker_thread+0x6c9/0xf70
kthread+0x2c9/0x3b0
ret_from_fork+0x4d/0x80
ret_from_fork_asm+0x1a/0x30
Security readout for executives and security teams
Plain-English summary
A Linux kernel flaw can free network access-control data while it is still in use during an unsuccessful filter migration. On systems using the mlxsw Spectrum switching driver and affected ACL functionality, this may cause crashes or potentially compromise confidentiality, integrity, and availability. The supplied evidence does not show active exploitation.
Executive priority
Treat this as a high-priority infrastructure update where mlxsw Spectrum ACL functionality is present. Prioritize network switches, appliances, and hosts whose failure would disrupt segmentation or traffic enforcement. Broader emergency action is not supported by the supplied evidence because active exploitation is unconfirmed and reachability depends on a specialized kernel driver path.
Technical view
During mlxsw Spectrum ACL TCAM rehash work, non-negative migration credits were incorrectly treated as proof of completion. If migration failed, the old region could still be destroyed while filters referenced it, causing a slab use-after-free. The fix prevents region destruction after failed migration. KASAN observed the fault in a custom 6.9-rc2 kernel.
Likely exposure
Exposure appears limited to affected Linux kernels operating relevant mlxsw Spectrum ACL TCAM functionality, typically associated with Mellanox Spectrum switching hardware. Systems not using this driver path are unlikely to reach the vulnerable logic. The supplied affected-version data is ambiguous, so confirm exposure against distribution or kernel-vendor advisories and the referenced stable commits.
Exploitation context
The supplied CVSS 3.1 score is 8.8, with low complexity and privileges required. However, the record is not in KEV, and the supplied sources provide no evidence of active exploitation or a public weaponized exploit. The demonstrated outcome is a KASAN-detected kernel use-after-free during rehash processing; real-world exploitability is not established here.
Researcher notes
CWE-416 applies. The failure occurs when a migration error leaves credits non-negative, allowing premature destruction of the source region. Remaining filters then dereference freed region memory during entry removal. The trace identifies mlxsw_sp_acl_ctcam_region_entry_remove and the mlxsw_core rehash workqueue. The bundle does not establish attacker-controlled triggering conditions or reliable security impact beyond the use-after-free.
Mitigation direction
Update to a vendor-supported kernel release containing the applicable referenced stable fix.
Check Linux distribution and appliance-vendor advisories for corrected package versions.
Prioritize updates on systems using mlxsw Spectrum hardware and ACL offload functionality.
Follow vendor guidance if an immediate corrected kernel is unavailable.
Validation and detection
Inventory kernel versions on systems using Mellanox Spectrum switching hardware.
Confirm whether the mlxsw Spectrum driver and ACL offload functionality are active.
Map installed kernel packages to the referenced stable fixes or vendor changelogs.
Review kernel diagnostics for mlxsw ACL rehash failures, KASAN reports, or unexplained crashes.
After updating, verify the running kernel includes the vendor's correction.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-416: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
3Timeline events
2ADP providers
9Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-416 · source CWE mapping
Use After Free
Use After Free represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.