F2fs-Tools F2fs.Fsck fsck_chk_orphan_node Code Execution Vulnerability
The fsck_chk_orphan_node function in f2fs-tools fails to validate the entry_count field from a crafted f2fs filesystem, leading to a heap buffer overflow. An attacker can provide a malicious filesystem image to trigger code execution.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the fsckchkorphannode functionality of F2fs-Tools F2fs.Fsck 1.13. A specially crafted f2fs filesystem can cause a heap buffer overflow resulting in a 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
The entry_count field from the on-disk orphan block is used without validation, leading to out-of-bounds read and write in loops.
Impact
An attacker could execute code in the context of fsck.f2fs, potentially gaining privileges during boot on Android devices.
What the attacker needed
Physical access to device or root to write block device; crafted f2fs filesystem image
How it was found
- Craft a malicious f2fs filesystem image with a large entry_count in an orphan block.
- Run fsck.f2fs on the crafted image.
- The program reads the entry_count and loops, causing out-of-bounds access.
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.
A filesystem checker program reads a number from the disk image that tells it how many orphan entries to process. It does not check if this number is too large, so it reads and writes past the end of a buffer. This can crash the program or let an attacker run their own code.
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.