DF-4877 / verdict.json
{ "finding_id": "DF-4877", "status": "untested", "reproduced": 0, "impact": "none", "confidence": "certain", "verdict": "afd_strategy() never bounds-checks bio_offset against mediasize (and the raw cdev path applies no clamp \u2014 bounds_check_with_mediasize() is dm-only), while narrowing the block number to u_int32_t lba and a 32-bit CDB LBA: any I/O at >= 2^32 sectors (2 TiB @512B) that must fail with EINVAL silently wraps onto low LBAs, so beyond-end writes clobber the start of the medium. Certain by construction; not runnable on a guest without ATAPI direct-access hardware.", "exploit_chain": "raw open /dev/afd0 -> pwrite at offset >= 2 TiB (legitimately out-of-range) -> lba = (offset/sectorsize) mod 2^32 (atapi-fd.c:258) -> ATAPI_WRITE_BIG CDB with wrapped LBA (atapi-fd.c:277-280) -> silent write to low blocks instead of EINVAL", "evidence": "VERDICT.md (trace: no clamp in strategy; dm-only bounds helper; ad keeps u64 lba); README.md", "kernel_refs": [ "sys/dev/disk/nata/atapi-fd.c:241", "sys/dev/disk/nata/atapi-fd.c:258", "sys/dev/disk/nata/atapi-fd.c:277", "sys/kern/subr_disk.c:1458", "sys/dev/disk/dm/device-mapper.c:400", "sys/dev/disk/nata/ata-disk.c:299" ], "poc_changes": "n/a \u2014 source-trace finding; hardware blocker shared with DF-4874", "attempts": 0, "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": 0, "guest_dirty": 0, "build_cmd": "", "run_cmd": "", "code_hash": "", "notes": "Correctness/data-integrity class (raw device already grants full medium to opener), same size lie family as DF-4798; kept Low for that reason.", "recommended_fix": "reject bio_offset/end beyond mediasize with EINVAL before building the CDB in afd_strategy()", "fix_status": "not_testable", "fix_baseline_reproduced": 0, "fix_patched_reproduced": 0, "fix_verdict": "No afd hardware on guest; fix adds the missing media-bounds rejection with bounds_check_with_mediasize()-equivalent semantics", "fix_evidence": "fix.diff (git apply --check OK)" } |