CVE-2025-71473 in lwext4
Summary
by MITRE • 11/20/2026
lwext4 through 1.0.0 contains a heap buffer overflow in ext4_fs_init_inode_bitmap() in src/ext4_fs.c because it does not validate s_inodes_per_group against the inode bitmap size. Attackers can supply a crafted ext4 image with an oversized s_inodes_per_group so memset writes past the heap buffer, corrupting memory and crashing the mounting application.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/20/2026
The vulnerability identified in lwext4 versions up to 1.0.0 represents a critical heap-based buffer overflow within the file system initialization logic. Specifically, the flaw resides in the ext4_fs_init_inode_bitmap function located in src/ext4_fs.c. This component is responsible for setting up the inode bitmap structures that track which inodes are allocated or free on an ext4 volume. The root cause of this vulnerability is a failure to perform adequate bounds checking when processing metadata from the disk image. During the initialization process, the code reads the s_inodes_per_group value directly from the superblock without validating it against the actual size of the inode bitmap buffer that has been allocated in heap memory. This lack of validation allows an attacker who controls the content of the ext4 image to manipulate this field and trigger a write operation beyond the boundaries of the allocated buffer.
From a technical perspective, the exploitation mechanism relies on supplying a crafted ext4 disk image where the s_inodes_per_group value is set to exceed the capacity of the corresponding inode bitmap array. When lwext4 processes this malformed metadata, it proceeds to execute a memset or similar memory initialization routine that attempts to write data based on the oversized count provided by the attacker. Because the destination buffer was allocated with a size derived from other parameters and not strictly bounded by s_inodes_per_group in this specific code path, the write operation spills over into adjacent heap memory regions. This out-of-bounds write corrupts critical heap metadata or neighboring variables, leading to immediate instability within the application running lwext4. The primary observable impact is a crash of the mounting application due to memory corruption that triggers segmentation faults or general protection violations in standard operating environments.
The operational impact of this vulnerability extends beyond simple denial of service through application crashes. In embedded systems and IoT devices where lightweight file system libraries like lwext4 are commonly deployed, such heap overflows can potentially be leveraged for more severe attacks if the memory layout allows it. Although the immediate description highlights a crash, arbitrary code execution is theoretically possible depending on how the corrupted data interacts with subsequent allocation or deallocation routines. This aligns with Common Weakness Enumeration CWE-122, which classifies heap-based buffer overflows as high-severity issues due to their potential for remote code execution and system compromise. The vulnerability also reflects CWE-20, Improper Input Validation, specifically the failure to verify that input data conforms to expected structural constraints before processing it in a security-critical context like file system parsing.
In terms of threat modeling and adversary behavior, this flaw maps directly to MITRE ATT&CK technique T1564.003, which covers Hidden Files and Directories within the context of persistence or evasion if an attacker were using such vulnerabilities to manipulate file systems on compromised devices. However, in its current manifestation as a crash vector during mounting operations, it is primarily relevant to initial access vectors where malicious storage media is introduced into a target environment. An adversary could distribute a specially crafted SD card or USB drive containing the malformed ext4 image. When an unsuspecting user mounts this volume using software powered by vulnerable versions of lwext4, the application would crash upon attempting to initialize the inode bitmap, effectively denying access to any legitimate data on that media and potentially destabilizing the host device if the crash propagates to critical system services.
Mitigation strategies must focus primarily on updating the underlying library to a patched version where this specific bounds check has been implemented. Developers integrating lwext4 should ensure they are not using versions 1.0.0 or earlier without applying community-provided patches that validate s_inodes_per_group against the calculated size of the inode bitmap before proceeding with memory initialization operations. For systems unable to update immediately, defensive programming practices such as implementing strict input validation layers at the point of image loading can help filter out malformed metadata structures. Additionally, enabling heap protection mechanisms like AddressSanitizer during development and testing phases is highly recommended to detect similar off-by-one or overflow errors early in the software lifecycle before they reach production environments.