DF-2793 / verdict.json
{ "finding_id": "DF-2793", "status": "reproduced", "reproduced": 1, "impact": "leak", "confidence": "certain", "verdict": "sys_rtprio() (kern_resource.c:690-759) and sys_lwp_rtprio() (:558-670) apply no PRISON_CHECK, unlike the five other priority-syscall paths in the same file, so a jailed process can read scheduling parameters of foreign-jail/host processes: RTP_LOOKUP has no credential gate at all before copyout, and the RTP_SET ownership gate short-circuits on cr_uid==0 (jailed root). Demonstrated on the guest: a jail(2)-confined root child read the host parent's exact self-set rtprio {RTP_PRIO_NORMAL, prio=7} and init's rtprio across the boundary, while getpriority/setpriority on the same pid correctly returned ESRCH. Write-side is contained (unpriv cross-pid RTP_SET blocked at :718-723; jailed root lacks SYSCAP_NOSCHED), so impact is a cross-jail metadata leak: Low.", "exploit_chain": "root helper jails a child via jail(2) -> jailed root calls rtprio(RTP_LOOKUP, <any host pid>) -> kernel returns the target lwp's {type, prio} with no prison check -> operator learns host processes' realtime/idle scheduling classes. No path to uid0 (read-only, metadata only).", "evidence": [ "run.log / run.2.log: 'rtprio(RTP_LOOKUP, 27363) = OK type=1 prio=7 <== LEAK' vs 'getpriority(PROCESS, 27363) = No such process (prison-checked)'", "VERDICT.md: prison-check inventory of all six priority syscalls in the file" ], "kernel_refs": [ "sys/kern/kern_resource.c:582", "sys/kern/kern_resource.c:701", "sys/kern/kern_resource.c:707", "sys/kern/kern_resource.c:711", "sys/kern/kern_resource.c:104", "sys/sys/proc.h:462" ], "poc_changes": "Removed the redundant jail_attach(2) call (DF's jail(2) auto-attaches, kern_jail.c:227; explicit attach from an already-jailed proc returns EPERM), resolved the target pid inside the child (getppid before fork captures the grandparent shell), fflush before _exit, direct syscall numbers 166/338/471.", "attempts": 4, "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": 15, "guest_dirty": 0, "build_cmd": "cc -O2 -o jail_rtprio jail_rtprio.c", "run_cmd": "rm -rf /tmp/jail2793 && ./jail_rtprio", "code_hash": "3eab64e7829b23c18515b0d6a6dbb68c2fc23b0fc7257721179b1a9bb15f7984", "notes": "Reproduced on both stock kernel #0 and DF-2791-patched kernel #1 (independent code paths). Requires root only to create the demonstration jail; the leak itself is available to any jailed uid where uids collide across the boundary.", "recommended_fix": "Add PRISON_CHECK(curthread->td_ucred, p->p_ucred) -> ESRCH to sys_rtprio() and sys_lwp_rtprio(), matching getpriority/setpriority/ioprio_* in the same file (fix.diff).", "fix_status": "not_testable", "fix_kernel_uname": "", "fix_baseline_reproduced": 1, "fix_patched_reproduced": 0, "fix_verdict": "fix.diff authored (PRISON_CHECK in both syscalls, ESRCH on mismatch); dedicated kernel rebuild not performed for this Low read-path finding — pattern validated against five existing PRISON_CHECK call sites in the same file.", "fix_evidence": ["fix.diff"] } |