Skip to content
Memory corruption Advisory Advanced CVE-2020-6070

F2fs-tools fsck.f2fs sanity_check_area_boundary code execution vulnerability

A crafted f2fs filesystem image can cause fsck.f2fs to perform out-of-bounds heap writes due to a logic flaw in superblock area boundary checks, potentially leading to code execution. An attacker can provide a malicious file to trigger this vulnerability.

Lilith >_> Follow

Originally disclosed on Cisco Talos

Medium 6.7 View original

An exploitable code execution vulnerability exists in the file system checking functionality of fsck.f2fs 1.12.0. A specially crafted f2fs file can cause a logic flaw and out-of-bounds heap operations, resulting in code execution.

Lilith [-,-], on Cisco Talos

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 area boundary checks in sanity_check_area_boundary allow all block addresses and segment counts to be zero, causing overlapping areas and uninitialized memory access that leads to out-of-bounds writes.

Impact

An attacker could achieve code execution by providing a malicious f2fs file to fsck.f2fs.

What the attacker needed

Victim runs fsck.f2fs on attacker file

The fix

The vulnerability was fixed in version 1.13 of f2fs-tools.

How it was found

  1. Craft a malicious f2fs filesystem image with a superblock where all block addresses and segment counts are zero.
  2. Run fsck.f2fs on the crafted image.
  3. The tool reads the superblock and passes sanity checks due to the zero values.
  4. During build_sit_entries, the journal pointer points to uninitialized memory and the loop count is controlled.
  5. The loop writes to a user-controlled offset in a user-controlled buffer, causing an out-of-bounds heap write.

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.

fsck.f2fs is a tool that checks and repairs f2fs filesystems. A specially crafted filesystem image can trick the tool into writing data outside the intended memory area, which could let an attacker run their own code on the machine running the check.

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.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.