Linux Kernel
CVE-2021-47107
HIGH
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessIdentify NFS server running 5.16-rc kernel
-
DeliveryEstablish NFS mount or RPC reachability
-
ExploitSend READDIR with count=0
-
ExecutionTrigger init_dirlist underflow
-
PersistXDR writes past kernel buffer
-
ImpactKernel memory corruption / DoS or LPE
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Buffer copy size validation
MITRE ATT&CK
1 technique across 1 tactic: Execution The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | The target system must be running Linux kernel 5.16-rc1 through 5.16-rc6 with the in-kernel NFS server (knfsd) enabled and actively exporting at least one filesystem that the attacker can reach. The attacker must be able to send NFS RPC traffic to the server (typically TCP/UDP port 2049) and must have sufficient access to issue a READDIR operation against an exported directory - which in most NFS deployments requires the client IP to be permitted in /etc/exports and any required AUTH_SYS/Kerberos credentials. Exploitation is limited by the extremely narrow affected version window (only 5.16 release candidates, never a stable release), meaning realistic targets are almost exclusively kernel developers, CI systems, or testers running mainline RC builds - not production deployments. |
| Impact | The CVSS 7.8 score with vector AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H indicates a local, low-complexity attack requiring low privileges - however, this rating is questionable because NFSD is a network-facing service and the trigger comes from a remote NFS client, suggesting the CVSS vector may understate exploitability for systems exposing NFS over the network. The EPSS score of 0.02% (4th percentile) is extremely low and the vulnerability is not in CISA KEV, indicating no observed real-world exploitation. Publicly available exploit code exists, but the practical risk is constrained by the narrow affected version range (5.16 release candidates only) - almost no production systems run RC kernels. The realistic risk to most environments is minimal; this is primarily relevant to kernel testers and rolling-release distributions that briefly shipped 5.16-rc builds. CVSS scope/vector vs. real-world deployment: high theoretical score, low practical priority. |
| Exploit ScenarioDerived | An attacker with the ability to send NFS requests to a vulnerable NFS server (either a malicious authorized client or an attacker on a network where NFS is exposed) issues a crafted READDIR RPC with a count argument of zero or a very small value. The underflowed buffer size calculation causes the XDR encoding routines to write directory entry data well past the end of the allocated reply buffer in kernel memory, resulting in kernel memory corruption that can lead to denial of service or potentially privilege escalation/code execution in ring 0. Publicly available exploit code exists demonstrating the trigger. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAI
Buffer overflow in the Linux kernel NFS server (NFSD) READDIR handler allows a malicious NFS client to trigger an out-of-bounds write by sending a crafted READDIR request with an undersized count argument. The flaw stems from an integer underflow in the init_dirlist buffer size calculation introduced when entry encoders were refactored, and affects Linux kernel 5.16 release candidates (rc1-rc6). Publicly available exploit code exists, though EPSS scores exploitation probability at only 0.02%.
RemediationAI
Upgrade to Linux kernel 5.16 final or any subsequent stable release, all of which contain the fix that adds proper sanity checking of the READDIR count argument in init_dirlist. Distribution-shipped kernels from major vendors (RHEL, SUSE, Ubuntu, Debian) were never affected because they did not ship 5.16 release candidates to end users; anyone running a 5.16-rc build should rebuild from a current mainline tree (git.kernel.org). As a compensating control for systems that cannot be patched immediately, disable the in-kernel NFS server (systemctl disable --now nfs-server) if NFS export is not required, or restrict access to the NFS ports (TCP/UDP 2049, 111, plus mountd) at the network layer via firewall rules to trusted client subnets only - the trade-off being loss of NFS service or reduced reachability for legitimate clients. Switching to a user-space NFS server (nfs-ganesha) would also avoid the kernel code path but introduces operational complexity and performance differences.
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The vulnerability resides in the kernel-mode NFS server subsystem (fs/nfsd) which implements the NFSv2/v3/v4 file-sharing protocols using XDR (External Data Representation) encoding. The READDIR RPC operation lets clients enumerate directory entries, with a 'count' argument specifying the maximum reply payload size. The newly introduced init_dirlist helper computes available buffer space via unsigned arithmetic; when the client supplies a tiny or zero count, the subtraction underflows to a very large unsigned value, which xdr_reserve_space() then trusts when performing pointer arithmetic. This is a classic CWE-120 buffer copy without size checking, but rooted in an integer underflow precondition that bypasses subsequent bounds logic. CPE data confirms only Linux kernel 5.16-rc1 through 5.16-rc6 are listed as affected, indicating the bug was introduced during the 5.16 development cycle and fixed before final release.
Know when the next one hits your stack
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Primary rating from NVD · only source for this CVE.
CVSS VectorNVD
DescriptionNVD
In the Linux kernel, the following vulnerability has been resolved:
NFSD: Fix READDIR buffer overflow
If a client sends a READDIR count argument that is too small (say, zero), then the buffer size calculation in the new init_dirlist helper functions results in an underflow, allowing the XDR stream functions to write beyond the actual buffer.
This calculation has always been suspect. NFSD has never sanity- checked the READDIR count argument, but the old entry encoders managed the problem correctly.
With the commits below, entry encoding changed, exposing the underflow to the pointer arithmetic in xdr_reserve_space().
Modern NFS clients attempt to retrieve as much data as possible for each READDIR request. Also, we have no unit tests that exercise the behavior of READDIR at the lower bound of @count values. Thus this case was missed during testing.
Executive ViewAI
A buffer overflow in the Linux kernel NFS server (NFSD) could allow remote attackers to trigger out-of-bounds memory writes via crafted READDIR requests. Organizations running Linux 5.16 release candidate kernels should immediately inventory affected systems and implement access controls, as no vendor patch is currently available despite publicly available exploit code.
No vendor-released patch identified at time of analysis. Interim mitigations: (1) Disable NFSD service on systems where NFS sharing is not required; (2) Restrict NFS network access at the firewall level to only trusted, known client IP ranges; (3) Implement enhanced monitoring and logging of NFS operations for suspicious READDIR activity; (4) Plan kernel upgrade once patched versions become available.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.
NVD
CVE.org
EPSS
VulDB
GitHub PoC
Exploit-DB