⬢ DragonFlyBSD Kernel Audit
DF-3172 / setup1.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-3172 phase-1 setup — run IN the guest as root.
# Build a LEGIT 4096-block UFS image (NINDIR=1024) and mount it RW.
# The unprivileged user then grows a sparse file to 560 GB (well within
# the legit fs_maxfilesize of 4.4 TB), which allocates the file's
# triple-indirect chain (i_ib[2] != 0) and sets di_size = 560 GB.
set -e
cd /root/df3172
umount /mnt/poc 2>/dev/null || true
vnconfig -u vn0 2>/dev/null || true
truncate -s 128M ffs4096.img
vnconfig -c vn0 ffs4096.img
newfs -b 4096 /dev/vn0 > newfs.out 2>&1
vnconfig -u vn0
vnconfig -c vn0 ffs4096.img
mkdir -p /mnt/poc
mount -t ufs /dev/vn0 /mnt/poc
mkdir -p /mnt/poc/d
chown maxx:maxx /mnt/poc/d
chmod 755 /mnt/poc /mnt/poc/d
echo PHASE1_OK