Files
vuln-cve/data/2025/40xxx/CVE-2025-40025.json
T

146 lines
9.7 KiB
JSON

{
"dataType": "CVE_RECORD",
"dataVersion": "5.2",
"cveMetadata": {
"cveId": "CVE-2025-40025",
"assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"state": "PUBLISHED",
"assignerShortName": "Linux",
"dateReserved": "2025-04-16T07:20:57.152Z",
"datePublished": "2025-10-28T09:32:31.806Z",
"dateUpdated": "2026-08-05T12:07:07.729Z"
},
"containers": {
"cna": {
"providerMetadata": {
"orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"shortName": "Linux",
"dateUpdated": "2026-08-05T12:07:07.729Z"
},
"descriptions": [
{
"lang": "en",
"value": "In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: fix to do sanity check on node footer for non inode dnode\n\nAs syzbot reported below:\n\n------------[ cut here ]------------\nkernel BUG at fs/f2fs/file.c:1243!\nOops: invalid opcode: 0000 [#1] SMP KASAN NOPTI\nCPU: 0 UID: 0 PID: 5354 Comm: syz.0.0 Not tainted 6.17.0-rc1-syzkaller-00211-g90d970cade8e #0 PREEMPT(full)\nRIP: 0010:f2fs_truncate_hole+0x69e/0x6c0 fs/f2fs/file.c:1243\nCall Trace:\n <TASK>\n f2fs_punch_hole+0x2db/0x330 fs/f2fs/file.c:1306\n f2fs_fallocate+0x546/0x990 fs/f2fs/file.c:2018\n vfs_fallocate+0x666/0x7e0 fs/open.c:342\n ksys_fallocate fs/open.c:366 [inline]\n __do_sys_fallocate fs/open.c:371 [inline]\n __se_sys_fallocate fs/open.c:369 [inline]\n __x64_sys_fallocate+0xc0/0x110 fs/open.c:369\n do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]\n do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94\n entry_SYSCALL_64_after_hwframe+0x77/0x7f\nRIP: 0033:0x7f1e65f8ebe9\n\nw/ a fuzzed image, f2fs may encounter panic due to it detects inconsistent\ntruncation range in direct node in f2fs_truncate_hole().\n\nThe root cause is: a non-inode dnode may has the same footer.ino and\nfooter.nid, so the dnode will be parsed as an inode, then ADDRS_PER_PAGE()\nmay return wrong blkaddr count which may be 923 typically, by chance,\ndn.ofs_in_node is equal to 923, then count can be calculated to 0 in below\nstatement, later it will trigger panic w/ f2fs_bug_on(, count == 0 || ...).\n\n\tcount = min(end_offset - dn.ofs_in_node, pg_end - pg_start);\n\nThis patch introduces a new node_type NODE_TYPE_NON_INODE, then allowing\npassing the new_type to sanity_check_node_footer in f2fs_get_node_folio()\nto detect corruption that a non-inode dnode has the same footer.ino and\nfooter.nid.\n\nScripts to reproduce:\nmkfs.f2fs -f /dev/vdb\nmount /dev/vdb /mnt/f2fs\ntouch /mnt/f2fs/foo\ntouch /mnt/f2fs/bar\ndd if=/dev/zero of=/mnt/f2fs/foo bs=1M count=8\numount /mnt/f2fs\ninject.f2fs --node --mb i_nid --nid 4 --idx 0 --val 5 /dev/vdb\nmount /dev/vdb /mnt/f2fs\nxfs_io /mnt/f2fs/foo -c \"fpunch 6984k 4k\""
}
],
"metrics": [
{
"cvssV3_1": {
"version": "3.1",
"vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
"baseScore": 7.8,
"baseSeverity": "HIGH"
},
"scenarios": [
{
"lang": "en",
"value": "AV:L - The vulnerability is reached through local syscalls (fallocate/read/write/truncate) on a file residing in a mounted, attacker-crafted f2fs image; no network or remote protocol handling is involved.\nAC:L - The attacker fully controls the on-disk node footer (footer.ino == footer.nid) and the punch-hole offset/length, so the misparse and the resulting out-of-bounds access are deterministic — the commit ships a byte-exact reproducer via inject.f2fs plus a single xfs_io fpunch.\nPR:L - Once the crafted image is mounted (removable media/automount, shared workstation, or Android SD card), triggering requires only an unprivileged local user issuing a normal fallocate or read on a file in that filesystem — no capability check exists on the path from vfs_fallocate to f2fs_get_dnode_of_data.\nUI:N - After the malicious image is present, the attacker performs every step themselves; no victim action is needed to reach f2fs_truncate_hole or the read/write paths that hit the same misparse.\nS:U - The corruption is confined to kernel memory within the same security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - f2fs_data_blkaddr() indexes i_addr (base byte 360) with a direct-node offset up to 1017, reading past the end of the 4 KiB node folio; the leaked adjacent kernel memory becomes dn->data_blkaddr, which f2fs then treats as a physical block address and may read into the page cache, exposing arbitrary disk and heap contents.\nI:H - __set_data_blkaddr() writes through the same out-of-bounds pointer, and with CONFIG_F2FS_CHECK_FS disabled the f2fs_bug_on degrades to WARN_ON so the underflowed, attacker-chosen count is passed to f2fs_truncate_data_blocks_range, yielding an attacker-controlled-length out-of-bounds write past the node folio plus invalidation of arbitrary filesystem blocks.\nA:H - With CONFIG_F2FS_CHECK_FS enabled this is a hard BUG_ON at fs/f2fs/file.c:1243 causing immediate kernel panic (as syzbot reported), and without it the out-of-bounds writes corrupt adjacent kernel memory and filesystem metadata, crashing the system."
}
]
}
],
"affected": [
{
"product": "Linux",
"vendor": "Linux",
"defaultStatus": "unaffected",
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"programFiles": [
"fs/f2fs/f2fs.h",
"fs/f2fs/gc.c",
"fs/f2fs/node.c",
"fs/f2fs/node.h",
"fs/f2fs/recovery.c"
],
"versions": [
{
"version": "98e4da8ca301e062d79ae168c67e56f3c3de3ce4",
"lessThan": "186098f34b8a5d65eb828f952c8cc56272c60ea0",
"status": "affected",
"versionType": "git"
},
{
"version": "98e4da8ca301e062d79ae168c67e56f3c3de3ce4",
"lessThan": "c18ecd99e0c707ef8f83cace861cbc3162f4fdf1",
"status": "affected",
"versionType": "git"
}
]
},
{
"product": "Linux",
"vendor": "Linux",
"defaultStatus": "affected",
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"programFiles": [
"fs/f2fs/f2fs.h",
"fs/f2fs/gc.c",
"fs/f2fs/node.c",
"fs/f2fs/node.h",
"fs/f2fs/recovery.c"
],
"versions": [
{
"version": "3.8",
"status": "affected"
},
{
"version": "0",
"lessThan": "3.8",
"status": "unaffected",
"versionType": "semver"
},
{
"version": "6.17.2",
"lessThanOrEqual": "6.17.*",
"status": "unaffected",
"versionType": "semver"
},
{
"version": "6.18",
"lessThanOrEqual": "*",
"status": "unaffected",
"versionType": "original_commit_for_fix"
}
]
}
],
"cpeApplicability": [
{
"nodes": [
{
"operator": "OR",
"negate": false,
"cpeMatch": [
{
"vulnerable": true,
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionStartIncluding": "3.8",
"versionEndExcluding": "6.17.2"
},
{
"vulnerable": true,
"criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
"versionStartIncluding": "3.8",
"versionEndExcluding": "6.18"
}
]
}
]
}
],
"references": [
{
"url": "https://git.kernel.org/stable/c/186098f34b8a5d65eb828f952c8cc56272c60ea0"
},
{
"url": "https://git.kernel.org/stable/c/c18ecd99e0c707ef8f83cace861cbc3162f4fdf1"
}
],
"title": "f2fs: fix to do sanity check on node footer for non inode dnode",
"x_generator": {
"engine": "bippy-1.2.0"
}
}
}
}