CVE-2026-10645: Zephyr ext2 Directory Entry Out-of-Bounds Memory Read & Denial of Service
Zephyr's ext2 filesystem driver contains memory safety flaws when processing directory entries on ext2-formatted storage devices. An attacker who supplies a crafted ext2 image—via USB drive, SD card, or mounted file—can trigger out-of-bounds reads that leak kernel heap memory, cause the system to hang indefinitely, or corrupt memory. Any filesystem operation (opening files, listing directories, deleting files, renaming) on the malicious volume triggers the defect. The vulnerability affects all Zephyr versions from 3.5.0 through 4.4.0.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 4.9 MEDIUM · CVSS:3.1/AV:P/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:H
- Weaknesses (CWE)
- CWE-125
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-06-23 / 2026-07-14
NVD description (verbatim)
The Zephyr ext2 filesystem driver (subsys/fs/ext2) trusted the on-disk directory entry fields de_rec_len and de_name_len when walking a directory block. ext2_fetch_direntry() guarded only with de_name_len > EXT2_MAX_FILE_NAME, but de_name_len is a uint8_t and EXT2_MAX_FILE_NAME 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 de_rec_len. Each directory block is read into a block_size-sized slab buffer, and block_off can be driven near the block end by preceding entries' rec_len, 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 fs_dirent.name, leaking adjacent kernel heap memory; a de_rec_len of 0 also causes a zero-progress infinite loop (denial of service), and the unlink path's memmove(de, next, next_reclen) 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 rec_len and name_len in the parser and rejects entries whose header does not fit the remaining block or whose rec_len crosses the block boundary in every traversal caller.
2 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The ext2_fetch_direntry() function in Zephyr's ext2 driver (subsys/fs/ext2) fails to properly validate two critical fields in directory entry headers: de_rec_len (record length) and de_name_len (name length). The name_len field is a uint8_t with a maximum value of 255, and the driver only checks if de_name_len exceeds EXT2_MAX_FILE_NAME (also 255), making the guard condition permanently false. This allows the driver to memcpy up to 255 bytes into a fixed buffer regardless of actual data present. More critically, de_rec_len is never validated before use; it controls how many bytes the parser advances within a block. Since directory blocks are stored in fixed-size slab buffers, a malicious de_rec_len can position the next entry read near or past the block boundary, enabling reads of 8-byte headers and subsequent name data (up to ~263 bytes total) into adjacent heap memory. The unlink code path compounds the risk by performing memmove() operations on unvalidated record lengths, creating out-of-bounds write exposure. A de_rec_len of zero causes infinite loop, triggering denial of service. Heap memory contents are leaked via the readdir() path, which returns directory entry names to userspace. The defect is reachable through any VFS operation (open, stat, unlink, rename, mkdir) or directory enumeration on a mounted ext2 volume.
Business impact
This vulnerability poses a layered risk depending on deployment context. In IoT and embedded systems where Zephyr is common, an attacker with ability to supply removable storage can leak sensitive kernel memory (potentially revealing cryptographic keys, memory addresses for ASLR bypass, or authentication tokens), trigger denial of service (causing device hang or reboot loops), or corrupt heap state leading to further exploitation. For devices that accept untrusted images (smart home hubs, industrial controllers with USB ports, development boards in lab environments), the barrier to exploitation is low: the attacker simply provides a malicious USB drive or SD card. Even in sandboxed or isolated systems, heap leaks can undermine isolation boundaries. Organizations deploying Zephyr-based products should assess whether end-users or field technicians have access to mount untrusted ext2 filesystems, and whether kernel memory in use might contain secrets.
Affected systems
Zephyr Project versions 3.5.0 through 4.4.0 are affected. The vulnerability resides in the ext2 filesystem driver and is triggered only when an ext2 volume is mounted and accessed. Systems using other filesystems (FAT, LITTLEFS, etc.) are not affected. Risk is highest for deployments that mount user-supplied or externally-sourced ext2 storage, or that accept ext2 disk images from untrusted sources. Zephyr 4.5.0 and later contain mitigations; users of versions 3.5.0–4.4.0 remain exposed.
Exploitability
Exploitability is straightforward for attackers with ability to supply storage. No authentication or elevated privileges are required—a crafted ext2 filesystem on a USB drive or SD card triggers the flaw upon mount and basic directory operations. The attack surface is wide: open, stat, unlink, rename, mkdir, and readdir all exercise the vulnerable code paths. The barrier to practical exploitation is manufacturing a malicious ext2 image, which is well within reach of any threat actor with basic filesystem knowledge. However, reliable exploitation for code execution requires additional heap grooming or spray techniques; the primary exploitable outcomes are denial of service (infinite loop via de_rec_len = 0) and information disclosure (heap memory leak via readdir). CVSS vector AV:P (physical or local) reflects that an attacker must mount storage locally; AC:L indicates no special conditions are required once an ext2 image is supplied; UI:R acknowledges user interaction (mounting the filesystem) but is a minor hurdle in unattended or automated scenarios.
Remediation
Apply patches from Zephyr 4.5.0 or later, which validate de_rec_len and de_name_len on every directory entry traversal. Verification steps: confirm that the ext2 parser rejects entries whose record length would overrun the block boundary, and that name lengths are bounded to the remaining space after the entry header. For versions 3.5.0–4.4.0, backport patches if available from the Zephyr security advisory or apply a kernel isolation strategy (e.g., mount ext2 volumes in a restricted namespace or disable ext2 support entirely if not in use). Mitigations: disable ext2 driver compilation if ext2 support is unnecessary for your product; restrict mount permissions to authenticated administrators; scan or validate ext2 images before mounting from external sources.
Patch guidance
Upgrade to Zephyr 4.5.0 or a later stable release. Before upgrading, verify your current version (zephyr --version or check VERSION file) and confirm that ext2 support is active in your build configuration (CONFIG_FILE_SYSTEM_EXT2 or similar). If upgrading is not immediately feasible, consult the official Zephyr security advisories for backported patches applicable to your version. Test upgrades in a controlled environment to ensure compatibility with your application and dependent modules, particularly those relying on ext2 for logging or data persistence.
Detection guidance
On systems running Zephyr versions 3.5.0–4.4.0 with ext2 enabled, monitor for abnormal behavior associated with directory operations: kernel panics or hangs after mounting ext2 volumes, repeated system crashes or resets, or unexpected memory corruption patterns. If heap memory leaks are suspected, enable kernel memory sanitizers (if available) or heap debugging tools during development. Review filesystem mounting logs and block device attachment events to identify when untrusted ext2 images are mounted. Use static analysis tools on Zephyr builds to check for CONFIG_FILE_SYSTEM_EXT2 status; disable it if not required. For forensics, examine crafted ext2 images for malformed directory entries with suspicious de_rec_len or de_name_len values (e.g., de_name_len = 0xFF, de_rec_len = 0 or very large values).
Why prioritize this
Despite a CVSS score of 4.9 (MEDIUM), this vulnerability merits higher-than-baseline attention in embedded and IoT contexts. The combination of straightforward exploitability (supply a malicious USB drive), multiple impact vectors (denial of service, information disclosure), and broad reachability (any filesystem operation) creates practical risk. The primary concern is information disclosure: heap memory leaks can expose cryptographic keys or pointers useful for further attacks. Secondary concern is denial of service in mission-critical IoT systems. Organizations should prioritize patching systems that accept removable or external storage, or that process ext2 filesystems from untrusted sources. Systems without ext2 support or that operate in fully controlled environments can deprioritize.
Risk score, explained
The CVSS 3.1 score of 4.9 reflects a physical attack vector (AV:P), low complexity (AC:L), no privilege requirement (PR:N), and limited scope (S:U). The impact is low confidentiality (C:L) from heap leaks and high availability (A:H) from denial-of-service loops. However, CVSS underweights the practical risk in embedded deployments where removable storage is common and heap leaks are particularly damaging. Organizations should consider context: a consumer IoT device with USB support poses higher actual risk than the CVSS score suggests, while a sealed industrial controller with no external ports poses lower risk.
Frequently asked questions
What if my Zephyr device doesn't use ext2 filesystems?
If your build disables CONFIG_FILE_SYSTEM_EXT2 or does not compile the ext2 driver, this vulnerability does not affect you. Verify your configuration and, if ext2 is unused, confirm it is explicitly disabled to avoid accidental linkage.
Can this be exploited remotely?
No. The attack vector is physical (AV:P): an attacker must supply a malicious ext2 image or storage device and cause it to be mounted locally. Remote exploitation is not possible unless an attacker can upload a crafted ext2 file and trick the system into mounting it, which is a separate social engineering or application-level vulnerability.
What is leaked if heap memory is exposed?
Heap leaks can expose kernel data structures, cryptographic keys, session tokens, pointer addresses (aiding ASLR bypass), and other sensitive state. The exact risk depends on what data the kernel is holding in heap at the time of the leak. Always assume the worst case: sensitive material could be present.
Is there a workaround if I cannot upgrade immediately?
Mitigations include: disabling ext2 driver compilation, restricting physical access to device ports, validating/scanning ext2 images before mounting, and running the system with heap sanitizers enabled during development and testing. None of these eliminate the vulnerability; patching is the definitive solution.
This analysis is provided for informational and operational planning purposes and does not constitute legal, compliance, or incident response advice. The vulnerability details, affected versions, and remediation guidance are based on published CVE data and official Zephyr advisories as of the stated publication date. Threat actors, exploitability, and real-world impact may evolve; consult official Zephyr security advisories and threat intelligence sources for updates. Patch versions, configuration options, and deployment-specific mitigations should be verified against your vendor's documentation before implementation. SEC.co assumes no liability for losses or damages arising from use or reliance on this analysis. Source: NVD (public-domain), retrieved 2026-07-28. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-10658HIGHZephyr Bluetooth ISO Buffer Underflow Memory Corruption
- CVE-2020-9711MEDIUMAdobe Acrobat Reader Out-of-Bounds Read Memory Disclosure
- CVE-2020-9713MEDIUMAdobe Acrobat Reader Memory Disclosure Vulnerability
- CVE-2025-15661MEDIUMlibssh2 Out-of-Bounds Heap Read in SFTP Symlink Handling
- CVE-2025-70101MEDIUMlwext4 1.0.0 Out-of-Bounds Read Denial of Service
- CVE-2026-0127MEDIUMAndroid Out-of-Bounds Read in Communication Processor – Impact & Patch Guidance
- CVE-2026-0128MEDIUMAndroid RTCP Out-of-Bounds Read Information Disclosure
- CVE-2026-0136MEDIUMAndroid Modem Out-of-Bounds Read Denial of Service