CVE-2026-10645: Out-of-bounds read in Zephyr ext2 directory entry traversal from a crafted filesystem image
The Zephyr ext2 filesystem driver (subsys/fs/ext2) trusted the on-disk directory entry fields dereclen and denamelen when walking a directory block. ext2fetchdirentry() guarded only with denamelen > EXT2MAXFILENAME, but denamelen is a uint8t and EXT2MAXFILENAME is 255, so the check is always false; the function then memcpy'd up to 255 name bytes and the lookup/readdir paths advanced traversal by an unvalidated dereclen. Each directory block is read into a blocksize-sized slab buffer, and blockoff can be driven near the block end by preceding entries' reclen, so the 8-byte header read and the subsequent name memcpy can read up to ~263 bytes past the end of the block buffer into adjacent heap/slab memory. On the readdir path those bytes are returned to the caller in fsdirent.name, leaking adjacent kernel heap memory; a dereclen of 0 also causes a zero-progress infinite loop (denial of service), and the unlink path's memmove(de, next, nextreclen) over unvalidated records is an additional OOB read/write source. The defect is reached by any path-based operation (open, stat, unlink, rename, mkdir) or directory listing on a mounted ext2 volume, so a crafted or corrupted ext2 image on attacker-supplied storage (SD card, USB mass storage, or otherwise mounted image) triggers it. Affected: Zephyr ext2 from its introduction in v3.5.0 through v4.4.0. The fix validates reclen and namelen in the parser and rejects entries whose header does not fit the remaining block or whose reclen crosses the block boundary in every traversal caller.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
In the ext2 directory parser (ext2_fetch_direntry and every traversal caller), validate that de_rec_len and de_name_len do not cause reads/writes beyond the remaining directory block (block_size). Reject directory entries whose header does not fit the remaining block or whose rec_len crosses the block boundary, instead of memcpy’ing the name using unvalidated de_name_len and advancing traversal using unvalidated de_rec_len.
Zephyr ext2 directory entry traversal (subsys/fs/ext2) Validate on-disk ext2 directory entry header fields (de_rec_len, de_name_len) and reject invalid entries = Enable strict bounds checks so entries whose header does not fit the remaining block or whose rec_len crosses the block boundary are rejected - Compensating control
Assume any crafted/corrupted ext2 image on attacker-supplied storage can trigger the bug via path-based operations (open, stat, unlink, rename, mkdir) or directory listing. Prevent untrusted ext2 images from being mounted (e.g., only mount trusted media/images).
Event History
Frequently Asked Questions
What is the severity of CVE-2026-10645?
The severity of CVE-2026-10645 is classified as medium with a score of 4.9.
How does CVE-2026-10645 affect the system?
CVE-2026-10645 can lead to out-of-bounds read and zero-progress directory traversal due to missing structural validation in directory entries.
Which software is impacted by CVE-2026-10645?
CVE-2026-10645 affects the Zephyr Project Zephyr RTOS.
Can CVE-2026-10645 be exploited remotely?
CVE-2026-10645 has an attack vector of P (physical), indicating that remote exploitation may not be possible.
What is the recommended action to mitigate CVE-2026-10645?
To mitigate CVE-2026-10645, it is advised to apply patches provided by the Zephyr Project for the directory entry validation.