Skip to main content

CVE-2021-46936: Vulnerability in Linux Linux

High
VulnerabilityCVE-2021-46936cvecve-2021-46936
Published: Tue Feb 27 2024 (02/27/2024, 09:44:02 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: net: fix use-after-free in tw_timer_handler A real world panic issue was found as follow in Linux 5.4. BUG: unable to handle page fault for address: ffffde49a863de28 PGD 7e6fe62067 P4D 7e6fe62067 PUD 7e6fe63067 PMD f51e064067 PTE 0 RIP: 0010:tw_timer_handler+0x20/0x40 Call Trace: <IRQ> call_timer_fn+0x2b/0x120 run_timer_softirq+0x1ef/0x450 __do_softirq+0x10d/0x2b8 irq_exit+0xc7/0xd0 smp_apic_timer_interrupt+0x68/0x120 apic_timer_interrupt+0xf/0x20 This issue was also reported since 2017 in the thread [1], unfortunately, the issue was still can be reproduced after fixing DCCP. The ipv4_mib_exit_net is called before tcp_sk_exit_batch when a net namespace is destroyed since tcp_sk_ops is registered befrore ipv4_mib_ops, which means tcp_sk_ops is in the front of ipv4_mib_ops in the list of pernet_list. There will be a use-after-free on net->mib.net_statistics in tw_timer_handler after ipv4_mib_exit_net if there are some inflight time-wait timers. This bug is not introduced by commit f2bf415cfed7 ("mib: add net to NET_ADD_STATS_BH") since the net_statistics is a global variable instead of dynamic allocation and freeing. Actually, commit 61a7e26028b9 ("mib: put net statistics on struct net") introduces the bug since it put net statistics on struct net and free it when net namespace is destroyed. Moving init_ipv4_mibs() to the front of tcp_init() to fix this bug and replace pr_crit() with panic() since continuing is meaningless when init_ipv4_mibs() fails. [1] https://groups.google.com/g/syzkaller/c/p1tn-_Kc6l4/m/smuL_FMAAgAJ?pli=1

AI-Powered Analysis

AILast updated: 06/26/2025, 09:37:22 UTC

Technical Analysis

CVE-2021-46936 is a use-after-free vulnerability in the Linux kernel's networking stack, specifically within the tw_timer_handler function responsible for handling TCP time-wait timers. The issue arises due to improper ordering in the destruction of network namespaces, where the ipv4_mib_exit_net function is called before tcp_sk_exit_batch. This leads to a scenario where tcp_sk_ops remains in front of ipv4_mib_ops in the pernet_list, causing the net->mib.net_statistics structure to be freed prematurely while there are still inflight time-wait timers referencing it. The root cause was introduced by a commit that moved net statistics onto the struct net and freed them upon network namespace destruction. This use-after-free condition can cause kernel panics due to invalid memory access, as demonstrated by the page fault and call trace provided. The vulnerability has been present since at least 2017 and affects Linux kernel version 5.4 and potentially others that include the problematic commit. The fix involves reordering initialization calls and replacing critical error logging with a kernel panic to prevent continued operation in an unstable state. No known exploits are currently reported in the wild, but the vulnerability can cause denial of service through kernel crashes. The issue is complex and relates to the internal lifecycle management of network namespaces and TCP timers in the Linux kernel's networking subsystem.

Potential Impact

For European organizations, this vulnerability poses a risk primarily to servers and infrastructure running vulnerable Linux kernel versions, especially those utilizing network namespaces extensively, such as containerized environments, cloud platforms, and multi-tenant systems. Exploitation leads to kernel panics causing denial of service, which can disrupt critical services, degrade availability, and impact business continuity. Given Linux's widespread use in European data centers, telecommunications, and government infrastructure, the potential for service outages is significant. Although no remote code execution or privilege escalation is indicated, the denial of service impact can affect high-availability systems and critical infrastructure. Organizations relying on Linux-based network virtualization or container orchestration platforms (e.g., Kubernetes) may be particularly vulnerable if they run affected kernel versions. The lack of known exploits reduces immediate risk but does not eliminate the threat, especially as attackers may develop exploits targeting this flaw. The vulnerability also highlights the importance of kernel stability in maintaining secure and reliable network operations.

Mitigation Recommendations

European organizations should prioritize updating Linux kernels to versions where this vulnerability is patched, ensuring that the fix involving the reordering of initialization and destruction functions is applied. Specifically, kernel versions released after the fix should be deployed. For environments where immediate patching is not feasible, organizations should limit exposure by restricting untrusted network namespace creation and usage, monitoring kernel logs for panic events related to tw_timer_handler, and implementing robust system monitoring and automated recovery mechanisms to minimize downtime. Container orchestration platforms should be updated to use patched kernel versions, and network namespace lifecycle management should be reviewed to avoid inflight timers during namespace destruction. Additionally, organizations should engage in proactive vulnerability management, including testing kernel updates in staging environments to verify stability and compatibility. Employing kernel hardening techniques and isolating critical workloads can further reduce impact. Finally, maintaining comprehensive backups and incident response plans will help mitigate operational disruptions caused by potential kernel panics.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-02-25T13:45:52.720Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9835c4522896dcbea777

Added to database: 5/21/2025, 9:09:09 AM

Last enriched: 6/26/2025, 9:37:22 AM

Last updated: 8/13/2025, 3:05:45 AM

Views: 13

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats