Skip to main content

CVE-2021-47107: Vulnerability in Linux Linux

High
VulnerabilityCVE-2021-47107cvecve-2021-47107
Published: Mon Mar 04 2024 (03/04/2024, 18:15:38 UTC)
Source: CVE
Vendor/Project: Linux
Product: Linux

Description

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.

AI-Powered Analysis

AILast updated: 06/30/2025, 21:43:12 UTC

Technical Analysis

CVE-2021-47107 is a vulnerability identified in the Linux kernel's Network File System daemon (NFSD) component, specifically related to the handling of the READDIR operation. The READDIR operation is used by NFS clients to read directory entries from an NFS server. The vulnerability arises from improper handling of the 'count' argument in the READDIR request. If a client sends a READDIR request with a very small or zero count value, the kernel's buffer size calculation in the init_dirlist helper function underflows. This underflow leads to incorrect pointer arithmetic in the xdr_reserve_space() function, which is responsible for reserving buffer space for XDR (External Data Representation) streams. Consequently, this allows the XDR stream functions to write beyond the allocated buffer boundaries, effectively causing a buffer overflow. This buffer overflow can potentially lead to memory corruption, which may be exploited to cause denial of service (system crashes) or potentially arbitrary code execution, depending on the attacker's capabilities and system configuration. The vulnerability was introduced due to changes in entry encoding that exposed the underflow issue, and the lack of sanity checks on the READDIR count argument in NFSD. Notably, older entry encoders handled this case correctly, but the new implementation missed this edge case. Modern NFS clients typically request large amounts of data per READDIR call, so this edge case was not well tested, and no unit tests existed to cover the lower bound of count values. The vulnerability affects specific Linux kernel versions identified by commit hashes, and it has been publicly disclosed and patched. However, no known exploits are currently reported in the wild. The absence of a CVSS score indicates that the severity assessment must be inferred from the technical details and potential impact.

Potential Impact

For European organizations, this vulnerability poses a significant risk, especially for those relying on Linux-based NFS servers for file sharing and storage infrastructure. Exploitation could allow an attacker with network access to the NFS server to trigger a buffer overflow by sending crafted READDIR requests. This could lead to denial of service conditions, disrupting critical file services and impacting business continuity. In worst-case scenarios, if exploited for arbitrary code execution, attackers could gain unauthorized access or escalate privileges on affected systems, potentially leading to data breaches or lateral movement within networks. Given the widespread use of Linux servers in European enterprises, public sector, and cloud environments, the vulnerability could affect a broad range of industries including finance, manufacturing, telecommunications, and government agencies. The impact is heightened in environments where NFS is exposed beyond trusted internal networks or where network segmentation is weak. Additionally, the lack of known exploits currently reduces immediate risk but does not eliminate the threat, as attackers may develop exploits over time. Organizations with legacy or unpatched Linux kernels are particularly vulnerable.

Mitigation Recommendations

European organizations should prioritize patching affected Linux kernel versions as soon as vendor updates are available. Immediate steps include: 1) Identifying all Linux systems running NFS server services and verifying kernel versions against the affected commits. 2) Applying official Linux kernel patches or upgrading to a fixed kernel version that addresses CVE-2021-47107. 3) Implementing network-level controls to restrict NFS access to trusted hosts only, using firewalls and network segmentation to limit exposure. 4) Monitoring NFS server logs for unusual READDIR requests, especially those with abnormally small or zero count values, which could indicate probing attempts. 5) Employing intrusion detection systems (IDS) with signatures or heuristics for anomalous NFS traffic patterns. 6) Conducting internal security assessments and penetration tests focusing on NFS services to identify potential exploitation vectors. 7) Educating system administrators about this vulnerability and the importance of validating input parameters in network services. These measures go beyond generic advice by focusing on both patch management and proactive detection of exploitation attempts specific to the NFS READDIR operation.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
Linux
Date Reserved
2024-03-04T18:12:48.835Z
Cisa Enriched
true
Cvss Version
null
State
PUBLISHED

Threat ID: 682d9834c4522896dcbe9d4b

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

Last enriched: 6/30/2025, 9:43:12 PM

Last updated: 8/8/2025, 6:53:27 AM

Views: 12

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