Skip to main content

CVE-2021-46929: Vulnerability in Linux Linux

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

Description

In the Linux kernel, the following vulnerability has been resolved: sctp: use call_rcu to free endpoint This patch is to delay the endpoint free by calling call_rcu() to fix another use-after-free issue in sctp_sock_dump(): BUG: KASAN: use-after-free in __lock_acquire+0x36d9/0x4c20 Call Trace: __lock_acquire+0x36d9/0x4c20 kernel/locking/lockdep.c:3218 lock_acquire+0x1ed/0x520 kernel/locking/lockdep.c:3844 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:168 spin_lock_bh include/linux/spinlock.h:334 [inline] __lock_sock+0x203/0x350 net/core/sock.c:2253 lock_sock_nested+0xfe/0x120 net/core/sock.c:2774 lock_sock include/net/sock.h:1492 [inline] sctp_sock_dump+0x122/0xb20 net/sctp/diag.c:324 sctp_for_each_transport+0x2b5/0x370 net/sctp/socket.c:5091 sctp_diag_dump+0x3ac/0x660 net/sctp/diag.c:527 __inet_diag_dump+0xa8/0x140 net/ipv4/inet_diag.c:1049 inet_diag_dump+0x9b/0x110 net/ipv4/inet_diag.c:1065 netlink_dump+0x606/0x1080 net/netlink/af_netlink.c:2244 __netlink_dump_start+0x59a/0x7c0 net/netlink/af_netlink.c:2352 netlink_dump_start include/linux/netlink.h:216 [inline] inet_diag_handler_cmd+0x2ce/0x3f0 net/ipv4/inet_diag.c:1170 __sock_diag_cmd net/core/sock_diag.c:232 [inline] sock_diag_rcv_msg+0x31d/0x410 net/core/sock_diag.c:263 netlink_rcv_skb+0x172/0x440 net/netlink/af_netlink.c:2477 sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:274 This issue occurs when asoc is peeled off and the old sk is freed after getting it by asoc->base.sk and before calling lock_sock(sk). To prevent the sk free, as a holder of the sk, ep should be alive when calling lock_sock(). This patch uses call_rcu() and moves sock_put and ep free into sctp_endpoint_destroy_rcu(), so that it's safe to try to hold the ep under rcu_read_lock in sctp_transport_traverse_process(). If sctp_endpoint_hold() returns true, it means this ep is still alive and we have held it and can continue to dump it; If it returns false, it means this ep is dead and can be freed after rcu_read_unlock, and we should skip it. In sctp_sock_dump(), after locking the sk, if this ep is different from tsp->asoc->ep, it means during this dumping, this asoc was peeled off before calling lock_sock(), and the sk should be skipped; If this ep is the same with tsp->asoc->ep, it means no peeloff happens on this asoc, and due to lock_sock, no peeloff will happen either until release_sock. Note that delaying endpoint free won't delay the port release, as the port release happens in sctp_endpoint_destroy() before calling call_rcu(). Also, freeing endpoint by call_rcu() makes it safe to access the sk by asoc->base.sk in sctp_assocs_seq_show() and sctp_rcv(). Thanks Jones to bring this issue up. v1->v2: - improve the changelog. - add kfree(ep) into sctp_endpoint_destroy_rcu(), as Jakub noticed.

AI-Powered Analysis

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

Technical Analysis

CVE-2021-46929 is a use-after-free vulnerability in the Linux kernel's SCTP (Stream Control Transmission Protocol) implementation. The issue arises in the sctp_sock_dump() function, where an endpoint (ep) is freed prematurely after being accessed via asoc->base.sk but before the lock_sock(sk) call. This leads to a use-after-free condition, which can cause kernel crashes or potentially allow an attacker to execute arbitrary code in kernel space. The root cause is that the endpoint is freed too early, and the patch delays freeing the endpoint by using call_rcu(), a Read-Copy-Update mechanism that defers freeing until it is safe. This ensures the endpoint remains alive while being accessed and locked, preventing the use-after-free. The fix moves the sock_put and endpoint free operations into sctp_endpoint_destroy_rcu(), which is called after the RCU grace period. The vulnerability is triggered when an SCTP association is peeled off, and the old socket is freed prematurely. The patch also adds checks to skip processing if the endpoint is no longer alive. This vulnerability affects Linux kernel versions containing the specified commit (d25adbeb0cdb860fb39e09cdd025e9cfc954c5ab) and earlier versions without the patch. No known exploits are reported in the wild yet. The vulnerability is technical and specific to SCTP, a transport layer protocol used in some telecom and networking environments. Exploitation requires triggering SCTP socket operations that cause the use-after-free condition.

Potential Impact

For European organizations, the impact depends on their use of Linux systems running vulnerable kernel versions and whether they utilize SCTP for networking. SCTP is commonly used in telecom infrastructure, signaling, and some specialized applications. Organizations in telecom, critical infrastructure, and data centers using Linux with SCTP enabled could face kernel crashes leading to denial of service or potentially privilege escalation if an attacker crafts malicious SCTP packets. This could disrupt services, cause outages, or allow attackers to gain kernel-level control. Given the Linux kernel's widespread use across servers and embedded devices in Europe, the vulnerability could affect a broad range of systems if unpatched. However, exploitation complexity and the need for SCTP usage limit the attack surface. Still, critical infrastructure operators and telecom providers should prioritize patching to avoid service disruptions and security breaches.

Mitigation Recommendations

European organizations should apply the Linux kernel patch that fixes CVE-2021-46929 as soon as possible. Specifically, they should update to kernel versions that include the call_rcu() based fix in the SCTP subsystem. For environments where immediate patching is challenging, mitigating controls include disabling SCTP if not required, or restricting SCTP traffic via network firewalls and segmentation to limit exposure. Monitoring kernel logs for unusual SCTP-related errors or crashes can help detect exploitation attempts. Organizations should also audit their Linux systems to identify vulnerable kernel versions and SCTP usage. For telecom operators, coordination with vendors and infrastructure providers to deploy patched kernel versions is critical. Additionally, employing kernel hardening techniques and runtime protections can reduce exploitation risk.

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: 682d9835c4522896dcbea722

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

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

Last updated: 8/5/2025, 2:47:15 AM

Views: 18

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