Phase 8: baseline snapshot and reset; validated attack path

snapshot freezes each golden disk into images/base/ and boots a thin
overlay; reset recreates the overlay in about a second. Shutdown now asks
the guest over WinRM because ACPI powerdown is ignored by Server 2022.

dc01-post: grant GenericAll with dsacls (the .NET ACL API reported success
but never persisted the ACE) and set MinPasswordAge to zero, without which
the ACL reset fails.

Attack path validated end to end against the live lab: web -> SMB creds ->
AS-REP -> Kerberoast -> WinRM -> GenericAll reset -> DCSync.
This commit is contained in:
2026-10-21 20:10:06 -04:00
parent 645adea875
commit 71e05d6aa6
6 changed files with 96 additions and 26 deletions
+24 -6
View File
@@ -40,7 +40,18 @@ backend_check() {
}
# ------------------------------------------------------------------ layout
qemu_disk() { printf '%s/images/%s.qcow2' "$LAB_ROOT" "$1"; }
qemu_base() { printf '%s/images/base/%s-base.qcow2' "$LAB_ROOT" "$1"; }
qemu_overlay(){ printf '%s/images/overlays/%s.qcow2' "$LAB_ROOT" "$1"; }
# Boot the overlay when a baseline exists, the golden disk otherwise.
qemu_disk() {
local overlay
overlay=$(qemu_overlay "$1")
if [[ -f $overlay ]]; then printf '%s' "$overlay"; else printf '%s/images/%s.qcow2' "$LAB_ROOT" "$1"; fi
}
# The disk created by `build`, before it is frozen into a base image.
qemu_golden() { printf '%s/images/%s.qcow2' "$LAB_ROOT" "$1"; }
qemu_pidfile(){ printf '%s/run/%s.pid' "$LAB_ROOT" "$1"; }
qemu_log() { printf '%s/run/%s.log' "$LAB_ROOT" "$1"; }
qemu_monitor(){ printf '%s/run/%s.monitor' "$LAB_ROOT" "$1"; }
@@ -66,7 +77,7 @@ backend_running() {
backend_create_disk() {
local name=$1 dry=${2:-0}
local disk i size
disk=$(qemu_disk "$name")
disk=$(qemu_golden "$name")
i=$(vm_index "$name") || die "unknown vm: $name"
size=${VM_DISK[$i]}
@@ -154,17 +165,23 @@ backend_launch() {
}
backend_stop() {
local name=$1 sock pid i
local name=$1 sock pid ip i
backend_running "$name" || { info " $name already stopped"; return 0; }
sock=$(qemu_monitor "$name")
pid=$(<"$(qemu_pidfile "$name")")
ip=${VM_IPS[$(vm_index "$name")]}
if [[ -S $sock ]]; then
# ACPI powerdown is best-effort; Server 2022 often ignores it. Asking the
# guest to shut itself down over WinRM is what actually works.
if _winrm "$ip" ps "shutdown.exe /s /t 3 /f" >/dev/null 2>&1; then
detail "shutdown requested over WinRM"
elif [[ -S $sock ]]; then
printf 'system_powerdown\n' | socat - "UNIX-CONNECT:$sock" >/dev/null 2>&1 || true
fi
for i in $(seq 1 30); do
for i in $(seq 1 90); do
kill -0 "$pid" 2>/dev/null || break
sleep 1
done
@@ -172,7 +189,8 @@ backend_stop() {
if kill -0 "$pid" 2>/dev/null; then
warn "$name did not shut down cleanly, sending TERM"
kill "$pid" 2>/dev/null || true
sleep 2
sleep 3
kill -9 "$pid" 2>/dev/null || true
fi
rm -f "$(qemu_pidfile "$name")"
ok "$name stopped"