Skip to main content

CVE-2025-21756: Vulnerability in Linux Linux

High
VulnerabilityCVE-2025-21756cvecve-2025-21756
Published: Thu Feb 27 2025 (02/27/2025, 02:18:11 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

In the Linux kernel, the following vulnerability has been resolved: vsock: Keep the binding until socket destruction Preserve sockets bindings; this includes both resulting from an explicit bind() and those implicitly bound through autobind during connect(). Prevents socket unbinding during a transport reassignment, which fixes a use-after-free: 1. vsock_create() (refcnt=1) calls vsock_insert_unbound() (refcnt=2) 2. transport->release() calls vsock_remove_bound() without checking if sk was bound and moved to bound list (refcnt=1) 3. vsock_bind() assumes sk is in unbound list and before __vsock_insert_bound(vsock_bound_sockets()) calls __vsock_remove_bound() which does: list_del_init(&vsk->bound_table); // nop sock_put(&vsk->sk); // refcnt=0 BUG: KASAN: slab-use-after-free in __vsock_bind+0x62e/0x730 Read of size 4 at addr ffff88816b46a74c by task a.out/2057 dump_stack_lvl+0x68/0x90 print_report+0x174/0x4f6 kasan_report+0xb9/0x190 __vsock_bind+0x62e/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Allocated by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 __kasan_slab_alloc+0x85/0x90 kmem_cache_alloc_noprof+0x131/0x450 sk_prot_alloc+0x5b/0x220 sk_alloc+0x2c/0x870 __vsock_create.constprop.0+0x2e/0xb60 vsock_create+0xe4/0x420 __sock_create+0x241/0x650 __sys_socket+0xf2/0x1a0 __x64_sys_socket+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e Freed by task 2057: kasan_save_stack+0x1e/0x40 kasan_save_track+0x10/0x30 kasan_save_free_info+0x37/0x60 __kasan_slab_free+0x4b/0x70 kmem_cache_free+0x1a1/0x590 __sk_destruct+0x388/0x5a0 __vsock_bind+0x5e1/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e refcount_t: addition on 0; use-after-free. WARNING: CPU: 7 PID: 2057 at lib/refcount.c:25 refcount_warn_saturate+0xce/0x150 RIP: 0010:refcount_warn_saturate+0xce/0x150 __vsock_bind+0x66d/0x730 vsock_bind+0x97/0xe0 __sys_bind+0x154/0x1f0 __x64_sys_bind+0x6e/0xb0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e refcount_t: underflow; use-after-free. WARNING: CPU: 7 PID: 2057 at lib/refcount.c:28 refcount_warn_saturate+0xee/0x150 RIP: 0010:refcount_warn_saturate+0xee/0x150 vsock_remove_bound+0x187/0x1e0 __vsock_release+0x383/0x4a0 vsock_release+0x90/0x120 __sock_release+0xa3/0x250 sock_close+0x14/0x20 __fput+0x359/0xa80 task_work_run+0x107/0x1d0 do_exit+0x847/0x2560 do_group_exit+0xb8/0x250 __x64_sys_exit_group+0x3a/0x50 x64_sys_call+0xfec/0x14f0 do_syscall_64+0x93/0x1b0 entry_SYSCALL_64_after_hwframe+0x76/0x7e

AI-Powered Analysis

AILast updated: 07/03/2025, 04:27:51 UTC

Technical Analysis

CVE-2025-21756 is a high-severity use-after-free vulnerability in the Linux kernel's vsock (virtual socket) subsystem. The vulnerability arises from improper handling of socket bindings during transport reassignment. Specifically, the kernel fails to preserve socket bindings correctly, leading to a situation where a socket can be unbound prematurely during the reassignment process. This causes a use-after-free condition when the kernel attempts to access or manipulate a socket structure that has already been freed. The flaw is rooted in the reference counting mechanism for sockets, where the reference count can underflow due to incorrect removal of socket bindings, triggering kernel warnings and potential memory corruption. The vulnerability is triggered through the bind() system call on vsock sockets and involves complex interactions between vsock_create(), vsock_insert_unbound(), vsock_remove_bound(), and vsock_bind() functions. Exploitation could lead to arbitrary code execution in kernel context, denial of service via kernel panic, or privilege escalation. The vulnerability affects specific Linux kernel versions identified by commit hashes and was publicly disclosed on February 27, 2025. The CVSS v3.1 score is 7.8, reflecting high impact on confidentiality, integrity, and availability, with low attack complexity but requiring local privileges and no user interaction. No known exploits are currently reported in the wild. The issue is classified under CWE-416 (Use After Free).

Potential Impact

For European organizations, this vulnerability poses a significant risk, especially for those relying on Linux-based infrastructure, including servers, cloud environments, and embedded systems using vsock for inter-VM or host-guest communication. Exploitation could allow attackers with local access to execute arbitrary code at the kernel level, potentially leading to full system compromise, data breaches, or disruption of critical services. This is particularly concerning for sectors with high reliance on Linux, such as finance, telecommunications, government, and critical infrastructure. The ability to escalate privileges or cause denial of service could impact confidentiality, integrity, and availability of sensitive data and services. Given the widespread use of Linux in European data centers and enterprises, the vulnerability could have broad operational and security implications if left unpatched.

Mitigation Recommendations

1. Immediate application of official Linux kernel patches that address this vulnerability is critical. Organizations should track vendor advisories and update kernel versions to those including the fix for CVE-2025-21756. 2. For environments where immediate patching is not feasible, restrict local user access and enforce strict access controls to limit who can execute bind() calls on vsock sockets. 3. Employ kernel hardening techniques such as Kernel Address Space Layout Randomization (KASLR) and Control Flow Integrity (CFI) to reduce exploitation likelihood. 4. Monitor system logs for kernel warnings related to refcount underflow or use-after-free errors, which may indicate attempted exploitation. 5. Use security modules like SELinux or AppArmor to confine processes that interact with vsock sockets, minimizing potential attack surface. 6. In virtualized environments, consider isolating critical workloads and limiting vsock usage where possible until patches are applied. 7. Regularly audit and update Linux kernel versions as part of a robust patch management program to prevent exposure to similar vulnerabilities.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-12-29T08:45:45.760Z
Cisa Enriched
true
Cvss Version
3.1
State
PUBLISHED

Threat ID: 682d9832c4522896dcbe86ec

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

Last enriched: 7/3/2025, 4:27:51 AM

Last updated: 8/22/2025, 8:20:40 PM

Views: 25

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