E2fsprogs e2fsck rehash.c mutate_name() Code Execution Vulnerability
A crafted ext4 directory with a zero-length filename causes an out-of-bounds stack write in e2fsck's directory rehashing code. An attacker who can corrupt a filesystem partition could potentially achieve code execution when e2fsck is run.
Originally disclosed on Cisco Talos
A code execution vulnerability exists in the directory rehashing functionality of E2fsprogs e2fsck 1.45.4. A specially crafted ext4 directory can cause an out-of-bounds write on the stack, resulting in code execution.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the code fails to validate that the filename length read from disk is greater than zero, leading to an unsigned integer underflow when calculating an index into a stack buffer.
Impact
On 64-bit systems, exploitation is very unlikely because the stack is not large enough and requires an uncommon configuration; on 32-bit systems, exploitability depends on the binary and compiler.
What the attacker needed
Ability to corrupt a filesystem partition; e2fsck run on the corrupted filesystem; on 64-bit: ulimit -s unlimited
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
e2fsck is a tool that checks and repairs Linux filesystems. A bug in how it handles duplicate filenames can write data outside a small buffer on the stack, which is a region of memory used for temporary data. This could let someone run their own code if they can first corrupt the filesystem.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.