#!/usr/bin/env bash # Environment driver for the CVE-2026-129353 lab. # # ./run-lab.sh build build the lab image (fetches + verifies the firmware) # ./run-lab.sh up create the network and both routers (vuln / fixed) # ./run-lab.sh sweep run the PoC in every mode against both sides # ./run-lab.sh down stop and remove everything set -euo pipefail CVE="CVE-2026-129353" NET="cve129353lab" IMAGE="cve-2026-129353:lab" POC_IMAGE="cve-2026-129353-poc:local" HERE="$(cd "$(dirname "$0")" && pwd)" build() { podman build -f "$HERE/lab/lab.Dockerfile" -t "$IMAGE" "$HERE/lab" podman build -t "$POC_IMAGE" "$HERE/poc" } up() { podman network create "$NET" 2>/dev/null || true # Vulnerable side: the firmware binary exactly as shipped. podman run -d --name router-vuln --network "$NET" \ --cpus 2 --memory 4g -e LAB_BOUNDS_SHIM=0 "$IMAGE" # Remediated side: same binary, bounds-enforcing libc interposition # (the device is EOL; no vendor patch exists). podman run -d --name router-fixed --network "$NET" \ --cpus 2 --memory 4g -e LAB_BOUNDS_SHIM=1 "$IMAGE" } poc() { local target="$1"; shift podman run --rm --network "$NET" --cpus 2 --memory 512m \ "$POC_IMAGE" "$@" --host="$target" } sweep() { for mode in check exploit probe mitigation; do for side in vuln fixed; do echo "================ $mode / router-$side ================" set +e podman run --rm --network "$NET" --cpus 2 --memory 512m \ "$POC_IMAGE" "$mode" "--host=router-$side" | tee "$HERE/evidence/${mode}-${side}-run.txt" echo "exit: $?" set -e done done } down() { podman rm -f router-vuln router-fixed 2>/dev/null || true podman network rm "$NET" 2>/dev/null || true } case "${1:-}" in build) build ;; up) up ;; sweep) mkdir -p "$HERE/evidence"; sweep ;; down) down ;; *) echo "usage: $0 build|up|sweep|down"; exit 2 ;; esac