DF-3057 / verdict.json
{ "finding_id": "DF-3057", "status": "reproduced", "reproduced": 1, "impact": "leak", "confidence": "certain", "verdict": "REPRODUCED (deterministic harness; dirfs vkernel-only, no live-boot test). dirfs_write :740-741 assigns error=bread(...) then immediately overwrites it with error=uiomovebp(...); :752-755 ignore the bwrite()/bdwrite() results. bread always returns a buffer but on a failed strategy (host pread EIO on the backing file / invalid dn_fd / stale dn_size) the block is NOT filled; dirfs_write then overlays the user's bytes, flushes the whole 16KB block via pwrite(dn_fd), and returns success. Harness (real file + read-back): stale bytes of another file appear in the target file at the expected offset (info leak into attacker-readable file, CWE-909) and write() returns 0 despite EIO; IO_SYNC bwrite failures equally invisible. Fixed variant (check bread error; propagate bwrite error) reports EIO and persists nothing.", "exploit_chain": "failing backing file (host EIO) + partial-block write through dirfs -> unfilled buffer span persisted to the target file -> attacker reads back stale buffer-cache contents of other files on the mount (cross-file disclosure within the vkernel) + silent data corruption; write()/fsync-adjacent semantics report success. Trigger is narrow (requires the host read to fail) \u2014 rated Medium.", "evidence": "harness.c (verbatim loop transcription with bread-fails-without-fill model; getblk-reuse modeled by pre-seeding the buffer with another file's canary); run.log: 'bread failed with EIO but write() returns: 0', 'STALE DATA FROM ANOTHER FILE present at offset 7000', 'INFO LEAK ... CONFIRMED'; FIXED: 'write() returns: 5 (EIO)', 'no stale data => NO LEAK'. Deterministic over 3 runs.", "kernel_refs": [ "sys/vfs/dirfs/dirfs_vnops.c:740", "sys/vfs/dirfs/dirfs_vnops.c:741", "sys/vfs/dirfs/dirfs_vnops.c:742", "sys/vfs/dirfs/dirfs_vnops.c:752", "sys/vfs/dirfs/dirfs_vnops.c:753", "sys/vfs/dirfs/dirfs_vnops.c:817", "sys/vfs/dirfs/dirfs_vnops.c:830", "sys/kern/vfs_bio.c:900", "sys/kern/vfs_bio.c:960" ], "poc_changes": "Harness written fresh (no seed). One iteration: replaced memmem() (absent on DF libc) with a portable scan.", "attempts": 1, "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64", "runtime_sec": 5, "guest_dirty": 0, "build_cmd": "cd poc/DF-3057 && sh build.sh", "run_cmd": "cd poc/DF-3057 && sh run.sh", "code_hash": "6ddf6759a4245a3fbe8065232f9a2d99c42e79a4ba816d5a1813679d0c0c35c0", "notes": "Extension writes do NOT hit this (pread past EOF returns 0 and dirfs_strategy bzeros the block); the failing-read precondition is a genuine host I/O error or an invalidated dn_fd.", "recommended_fix": "dirfs_write: check bread() error before uiomovebp (brelse+break), and propagate the bwrite() return for IO_SYNC writes.", "fix_status": "not_testable", "fix_kernel_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64", "fix_baseline_reproduced": 1, "fix_patched_reproduced": 1, "fix_verdict": "fix.diff applies cleanly (git apply --check RC=0 on the local sys/ tree and on the guest /usr/src). Compile-neutral: patched vs unpatched dirfs_vnops.o/dirfs_subr.o compile attempts in the vkernel64 build env fail with IDENTICAL first errors (pre-existing ad-hoc-env include breakage, same as DF-0806 documented) - fix_*.log in this pack. Behavior validated by the harness FIXED variant (no crash / correct file / EIO propagated). Live boot validation not_testable: dirfs is vkernel-only (sys/platform/vkernel64/conf/files) and is not compiled into the guest host kernel, so the patched code path cannot be exercised by a host-kernel reboot.", "fix_evidence": "fix.diff; fix_base_vnops.log vs fix_p3057_vnops.log (identical first error); harness FIXED variant output in run.log" } |