A divide-by-zero vulnerability in the ext4blocksetlbsize function in src/ext4blockdev.c of the lwext4 1.0.0 library allows attackers to cause a denial of service by providing a malformed ext4 filesystem image that results in a zero logical block size. The vulnerability is triggered during mount or image processing and leads to a Floating-Point Exception (FPE) under sanitizers or a runtime crash in standard builds due to missing validation of lbsize.
Product: lwext4 Affected: lwext4 1.0.0, commit 58bcf89a121b72d4fb66334f1693d3b30e4cb9c5 CVE: CVE-2025-70101 CWE: CWE-125 (Out-of-bounds Read) CVSS 3.1: 6.5 MEDIUM (CISA-ADP: AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N) Reporter: Alexander A. Shvedov (@sigdevel) & Daniil Dulov
Description: An out-of-bounds read exists in lwext4 when traversing the extent tree of a crafted EXT4 filesystem image.
ext4extbinsearchidx() performs a binary search over extent index entries using pointers derived from the EXTFIRSTINDEX and EXTLASTINDEX macros. These macros compute bounds from the ehentries and ehdepth fields of the extent header. A crafted image can encode ehentries == 0 while ehdepth indicates an internal node, causing invalid pointer calculations and an out-of-bounds read during the binary search:
src/ext4extent.c:815 Function: ext4extbinsearchidx()
src/ext4extent.c:896 Function: ext4findextent()
The crash is reached during directory iteration through ext4findextent(), ext4extentgetblocks(), ext4diriteratorseek(), and ext4direntrynext(). An attacker who can supply a crafted EXT4 image to an application using lwext4 for mounting or directory traversal can cause denial of service.
Reproduction: The issue is reproducible with the public PoC image using the fuzzing harness:
./aflext4mountread ./sig11lwext4ext4extent815
ASan log excerpt: AddressSanitizer:DEADLYSIGNAL ==1900657==ERROR: AddressSanitizer: SEGV on unknown address 0x521000062a28 #0 0x5616a13f5f94 in ext4extbinsearchidx /home/labuser/target/2025/lwext4/src/ext4extent.c:815:13 #1 0x5616a13f5f94 in ext4findextent /home/labuser/target/2025/lwext4/src/ext4extent.c:896:3 #2 0x5616a13f7eb2 in ext4extentgetblocks /home/labuser/target/2025/lwext4/src/ext4extent.c:2038:8 #3 0x5616a13e6b20 in ext4fsgetinodedblkidxinternal /home/labuser/target/2025/lwext4/src/ext4fs.c:1370:12 #4 0x5616a13ddd1e in ext4diriteratorseek /home/labuser/target/2025/lwext4/src/ext4dir.c:244:7 #5 0x5616a13d6ea0 in ext4direntrynext /home/labuser/target/2025/lwext4/src/ext4.c:3226:6 SUMMARY: AddressSanitizer: SEGV /home/labuser/target/2025/lwext4/src/ext4extent.c:815:13 in ext4extbinsearchidx
Fix: https://github.com/Aladdin-R-D/lwext4/releases/tag/v1.0.1
References: https://github.com/gkostka/lwext4/issues/91 https://github.com/sigdevel/pocs/blob/main/res/lwext4/3/sig11lwext4ext4extent815 https://github.com/Aladdin-R-D/lwext4/releases/tag/v1.0.1 https://www.cve.org/CVERecord?id=CVE-2025-70101 https://nvd.nist.gov/vuln/detail/CVE-2025-70101 https://infosec.exchange/@sigdevel/116668958927817708 https://bdu.fstec.ru/vul/2025-15479
—— Best regards, Alexander A. Shvedov @sigdevel