⬢ DragonFlyBSD Kernel Audit
DF-5684 / vq_priv.c
← back to finding ↓ download raw
/*
 * DF-5684 — sys_vquotactl() performs no privilege check: an unprivileged
 * user can set mount-wide / per-uid / per-gid quota limits and wipe usage
 * accounting. Enforcement point: vop_write -> vq_write_ok()
 * (sys/kern/vfs_vopops.c:489) -> EDQUOT for EVERY writer on the mount,
 * including root. No priv_check/caps_priv_check exists anywhere in
 * sys_vquotactl (sys/kern/vfs_quota.c:328-413), in contrast with classic
 * quotactl(2) which enforces PRIV_VFS_QUOTA inside the FS code.
 *
 * We use the base-system tool vquota(8) as the unprivileged driver.
 *
 * Run:  as an UNPRIVILEGED user on a vfs.quota_enabled=1 kernel:
 *         vquota set limit / 1        # mount-wide write-DoS by uid 1001
 *       then as root: any append to a file on / fails with EDQUOT.
 */
#include <stdio.h>
int main(void){ fprintf(stderr, "use vq_priv.sh (drives /sbin/vquota)\n"); return 2; }