F2fs-Tools F2fs.Fsck Multiple Devices Code Execution Vulnerability
The f2fs.fsck tool reads a device path from the filesystem superblock and uses it to back block reads and writes. An attacker can craft a malicious f2fs filesystem that defines a device path pointing to an arbitrary file, such as /proc/self/mem, allowing reads and writes to that file and potentially leading to code execution.
Originally disclosed on Cisco Talos
An exploitable code execution vulnerability exists in the multiple devices functionality of F2fs-Tools F2fs.Fsck 1.13. A specially crafted f2fs filesystem can cause Information overwrite 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 f2fs superblock contains device paths that are used without proper validation, allowing an attacker to specify arbitrary files for block reads and writes.
Impact
An attacker could achieve code execution, and on Android, this could allow privilege escalation during boot, potentially bypassing verified boot, but requires physical access or temporary root.
What the attacker needed
Ability to provide a malicious f2fs image; on Android, physical access or temporary root
How it was found
- Craft an f2fs filesystem image with a superblock that defines multiple devices, including one with a path to a target file such as /proc/self/mem.
- Run f2fs.fsck on the crafted image.
- The tool reads the device paths and uses them for block I/O, allowing reads and writes to the specified file.
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.
f2fs.fsck is a program that checks and repairs f2fs filesystems. A filesystem can list extra files (devices) that store its data. The tool trusts these paths and uses them to read and write blocks. An attacker can make a filesystem that points to a sensitive file, like the program's own memory, and trick the tool into overwriting it, which can lead to running attacker code.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.