CVE-2025-21796 Overview
CVE-2025-21796 is a use-after-free vulnerability in the Linux kernel's NFS daemon (nfsd) subsystem, specifically within the POSIX ACL handling code. The vulnerability occurs when acl_access and acl_default pointers are not properly cleared after being released, leading to a dangling pointer condition that can be exploited to cause system instability or potentially achieve privilege escalation.
When the retrieval of acl_default fails during NFS3 ACL operations, both acl_access and acl_default are released simultaneously. However, the acl_access pointer retains a reference to the already-freed posix_acl structure. This dangling pointer triggers a refcount underflow warning and use-after-free condition when nfs3svc_release_getacl attempts to release the ACL again.
Critical Impact
Local attackers with low privileges can exploit this use-after-free vulnerability to potentially achieve high impacts on confidentiality, integrity, and availability of affected Linux systems running NFS services.
Affected Products
- Linux Kernel (multiple versions)
- Linux Kernel 6.14-rc1
- Linux Kernel 6.14-rc2
Discovery Timeline
- February 27, 2025 - CVE-2025-21796 published to NVD
- November 03, 2025 - Last updated in NVD database
Technical Details for CVE-2025-21796
Vulnerability Analysis
This vulnerability is classified as CWE-416 (Use After Free), representing a critical memory safety issue in kernel space. The flaw exists in the NFS daemon's ACL handling code path, where improper pointer management leads to dangerous memory access patterns.
The vulnerability is exploitable locally, requiring the attacker to have low privileges on the system. No user interaction is required to exploit this flaw. The scope is unchanged, meaning the vulnerability affects only the vulnerable component itself, but successful exploitation can result in complete compromise of the confidentiality, integrity, and availability of the affected system.
The root cause lies in the error handling path of the NFSD ACL retrieval functions. When an error occurs while fetching acl_default, the cleanup code releases both ACL structures but fails to nullify the acl_access pointer. This oversight creates a window where subsequent code paths may attempt to dereference or release the already-freed memory.
Root Cause
The vulnerability stems from improper memory management in the NFSD ACL handling code. Specifically, after calling posix_acl_release() on acl_access and acl_default, the pointers are not set to NULL. This violates the principle of defensive programming where released pointers should be immediately invalidated to prevent accidental reuse.
The problematic code path occurs in the error handling section where, upon failure to retrieve acl_default, both ACLs are released but only the error status is tracked. The acl_access pointer continues to hold the address of freed memory, creating a use-after-free condition when nfs3svc_release_getacl is subsequently invoked.
Attack Vector
The attack vector is local, requiring an attacker to have access to a system running the vulnerable NFS daemon. The exploitation scenario involves triggering the specific error condition where acl_default retrieval fails while acl_access has been successfully retrieved.
An attacker can manipulate file system conditions or NFS operations to induce the failure scenario. The kernel panic trace shows the vulnerability manifests through the refcount_warn_saturate function being triggered during the release operation in nfs3svc_release_getacl, indicating a reference count underflow due to the double-free condition.
The attack chain involves:
- Triggering NFS ACL operations on the target system
- Causing acl_default retrieval to fail while acl_access succeeds
- Waiting for the nfs3svc_release_getacl function to attempt releasing the dangling acl_access pointer
- Exploiting the resulting memory corruption for privilege escalation or denial of service
Detection Methods for CVE-2025-21796
Indicators of Compromise
- Kernel panic messages containing refcount_t: underflow; use-after-free warnings
- Stack traces referencing nfs3svc_release_getacl and refcount_warn_saturate functions
- Unexpected NFSD process crashes or system instability during ACL operations
- Kernel log entries showing WARNING messages from lib/refcount.c line 28
Detection Strategies
- Monitor kernel logs for refcount underflow warnings associated with NFS operations using tools like dmesg or journalctl
- Deploy kernel live patching solutions to detect and prevent exploitation attempts on unpatched systems
- Implement SentinelOne Singularity platform for real-time kernel-level threat detection and behavioral analysis
Monitoring Recommendations
- Enable kernel auditing for NFS-related syscalls and operations to track potential exploitation attempts
- Configure alerting on kernel panic events with stack traces containing nfs3svc_release_getacl
- Monitor NFS server resource utilization for anomalous patterns indicating exploitation activity
How to Mitigate CVE-2025-21796
Immediate Actions Required
- Apply the latest kernel security patches from your Linux distribution immediately
- Review NFS server exposure and restrict access to trusted networks only
- Consider temporarily disabling NFSv3 ACL support if patching is not immediately possible
- Monitor systems for signs of exploitation while preparing patch deployment
Patch Information
The Linux kernel maintainers have released patches to address this vulnerability across multiple kernel versions. The fix involves clearing acl_access and acl_default pointers to NULL after calling posix_acl_release() to prevent the use-after-free condition.
Multiple kernel commits have been published to address this issue:
- Kernel Commit 1fd94884174b
- Kernel Commit 2e59b2b68782
- Kernel Commit 55d947315fb5
- Kernel Commit 6f7cfee1a316
- Kernel Commit 7faf14a7b036
- Kernel Commit 8a1737ae42c9
- Kernel Commit f8d871523142
Debian users should refer to the Debian LTS Security Announcements for distribution-specific patches.
Workarounds
- Restrict NFS service access to trusted hosts only using firewall rules and /etc/exports configuration
- Disable NFSv3 ACL support by modifying NFS server configuration if not required for operations
- Implement network segmentation to limit exposure of NFS services to untrusted networks
- Consider migrating to NFSv4 which has different ACL handling mechanisms
# Configuration example
# Restrict NFS exports to specific trusted networks
# Edit /etc/exports to limit client access
/export/data 192.168.1.0/24(rw,sync,no_subtree_check,no_acl)
# Apply export changes
exportfs -ra
# Verify current exports
exportfs -v
# Optional: Block NFS ports from untrusted networks using iptables
iptables -A INPUT -p tcp --dport 2049 -s 192.168.1.0/24 -j ACCEPT
iptables -A INPUT -p tcp --dport 2049 -j DROP
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

