Cloudanix VulnDB

CVE-2025-38218

None

CVSS

—

EPSS

0.2%

Published

Jul 4, 2025

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

A flaw in how Linux handles certain file system images can cause computers to crash when trying to access them, so keeping the operating system updated prevents unexpected shutdowns and lost work.

Exploitation
Local Privilege
Attacker needs
Local User
Complexity
Moderate
Impact
Denial Of Service
Component
OS kernel
Class
Improper Input Validation
Remediation
Patch
Effort
Medium
Patch risk
Low

What it actually does

Missing sanity check on sit_bitmap_size in f2fs allows out-of-bounds access during build_sit_entries when mounting a resized image with inconsistent MAIN_SEGS and bitmap metadata, triggering f2fs_bug_on and kernel panic.

Why it matters to the business

Systems using f2fs filesystems can experience sudden crashes and reboots when mounting specially crafted or corrupted images, leading to downtime, data access loss, and operational disruption; high ecosystem prevalence increases exposure across Linux distributions and dependent packages.

How an attack unfolds

An attacker generates a malformed f2fs image by performing an oversized resize operation that creates inconsistent sit bitmap metadata, then distributes or tricks a victim into mounting the image, causing the kernel to panic during segment manager initialization. Threat actors in Advanced Spyware Campaign and September 2025 Active Exploitation Campaigns have targeted similar Linux kernel flaws for privilege escalation or denial of service.

How to fix it

Upgrade affected packages to the fixed versions: nats (Chainguard) to 0.2.3-r2, nats (Wolfi) to 0.2.3-r2, and Linux kernel to commit 82f51bff393e4c12cf4de553120ca831cfa4ef19 or later stable releases containing the f2fs_sanity_check_ckpt addition.

How to confirm the fix worked

Confirm the patch is applied by verifying presence of the sanity check in f2fs_sanity_check_ckpt; test by attempting to mount known malformed resize images and ensuring no BUG or panic occurs; review kernel build logs for the updated commit.

Typical attack path

  1. Create a large empty image file
  2. Format it with mkfs.f2fs using a small segment count
  3. Resize the image to a much larger size to produce inconsistent metadata
  4. Distribute or coerce mounting of the resulting corrupted image
  5. Trigger kernel panic on mount via f2fs_fill_super path

How to detect it

Search system logs for f2fs-related kernel panics or BUG entries at fs/f2fs/segment.h during mount operations; correlate with recent file system image handling or resize activity; review audit logs for mount syscalls on f2fs volumes from untrusted sources. Threat actor campaigns have shown interest in similar kernel paths for exploitation.

  • kernel BUG at fs/f2fs/segment.h:863
  • f2fs_ra_meta_pages
  • f2fs_build_segment_manager
  • sit_bitmap_size
  • Oops: invalid opcode: 0000

What your security team should do

  • Prioritize kernel and f2fs package updates on all Linux systems within the CISA-style remediation window if applicable
  • Disable automatic mounting of untrusted f2fs images via mount options or policy
  • Monitor for kernel oops and BUG reports referencing fs/f2fs/segment.h
  • Audit f2fs usage in high-availability environments given downstream package prevalence

The record

In the Linux kernel, the following vulnerability has been resolved: f2fs: fix to do sanity check on sit_bitmap_size w/ below testcase, resize will generate a corrupted image which contains inconsistent metadata, so when mounting such image, it will trigger kernel panic: touch img truncate -s $((512*1024*1024*1024)) img mkfs.f2fs -f img $((256*1024*1024)) resize.f2fs -s -i img -t $((1024*1024*1024)) mount img /mnt/f2fs ------------[ cut here ]------------ kernel BUG at fs/f2fs/segment.h:863! Oops: invalid opcode: 0000 [#1] SMP PTI CPU: 11 UID: 0 PID: 3922 Comm: mount Not tainted 6.15.0-rc1+ #191 PREEMPT(voluntary) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:f2fs_ra_meta_pages+0x47c/0x490 Call Trace: f2fs_build_segment_manager+0x11c3/0x2600 f2fs_fill_super+0xe97/0x2840 mount_bdev+0xf4/0x140 legacy_get_tree+0x2b/0x50 vfs_get_tree+0x29/0xd0 path_mount+0x487/0xaf0 __x64_sys_mount+0x116/0x150 do_syscall_64+0x82/0x190 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7fdbfde1bcfe The reaseon is: sit_i->bitmap_size is 192, so size of sit bitmap is 192*8=1536, at maximum there are 1536 sit blocks, however MAIN_SEGS is 261893, so that sit_blk_cnt is 4762, build_sit_entries() -> current_sit_addr() tries to access out-of-boundary in sit_bitmap at offset from [1536, 4762), once sit_bitmap and sit_bitmap_mirror is not the same, it will trigger f2fs_bug_on(). Let's add sanity check in f2fs_sanity_check_ckpt() to avoid panic.

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 linux 0 No fix
Debian:12 linux 0 No fix
Debian:13 linux 0 No fix
Debian:14 linux 0 6.12.35-1
Linux Kernel 3.8.0 5.10.239
Mageia:9 kernel 0 6.6.101-1.mga9
Mageia:9 kernel-linus 0 6.6.101-1.mga9
Mageia:9 kmod-virtualbox 0 7.1.10-7.mga9
Mageia:9 kmod-xtables-addons 0 3.24-83.mga9
Mageia:9 wireless-regdb 0 20250710-1.mga9

Related vulnerabilities