# setup_lab.ps1 - Windows PowerShell setup for CVE-2026-24136 lab # Usage: .\setup_lab.ps1 # Requires: Docker Desktop running, Python installed param( [string]$AdminEmail = "admin@example.com", [string]$AdminPassword = "admin", [int] $WaitTimeout = 180 ) $ErrorActionPreference = "Continue" Write-Host "======================================================" -ForegroundColor Cyan Write-Host " CVE-2026-24136 Lab Setup (Windows PowerShell)" -ForegroundColor Cyan Write-Host " Saleor IDOR - Unauthenticated PII Exfiltration" -ForegroundColor Cyan Write-Host "======================================================" -ForegroundColor Cyan # --- 1. Check dependencies --------------------------------------------------- Write-Host "`n[1/5] Checking dependencies..." -ForegroundColor Yellow foreach ($cmd in @("docker", "python")) { if (Get-Command $cmd -ErrorAction SilentlyContinue) { Write-Host " [OK] $cmd found" -ForegroundColor Green } else { Write-Host " [MISSING] $cmd - please install it and re-run." -ForegroundColor Red exit 1 } } docker info 2>$null | Out-Null if ($LASTEXITCODE -ne 0) { Write-Host " [ERROR] Docker Desktop is not running. Please start it first." -ForegroundColor Red exit 1 } Write-Host " [OK] Docker daemon is running" -ForegroundColor Green # --- 2. Start containers ----------------------------------------------------- Write-Host "`n[2/5] Starting Docker containers..." -ForegroundColor Yellow docker compose up -d if ($LASTEXITCODE -ne 0) { Write-Host " [ERROR] docker compose up -d failed." -ForegroundColor Red exit 1 } Write-Host " [OK] Containers started" -ForegroundColor Green # --- 3. Wait for Saleor API -------------------------------------------------- Write-Host "`n[3/5] Waiting for Saleor API (timeout: $WaitTimeout`s)..." -ForegroundColor Yellow $elapsed = 0 $ready = $false while ($elapsed -lt $WaitTimeout) { try { $resp = Invoke-WebRequest -Uri "http://localhost:8000/health/" ` -UseBasicParsing -TimeoutSec 3 -ErrorAction Stop if ($resp.StatusCode -eq 200) { $ready = $true break } } catch { # still starting up } Write-Host -NoNewline "." Start-Sleep -Seconds 5 $elapsed += 5 } if (-not $ready) { Write-Host "" Write-Host " [ERROR] API did not start within $WaitTimeout`s." -ForegroundColor Red Write-Host " Check logs: docker compose logs saleor_api" -ForegroundColor Yellow exit 1 } Write-Host "" Write-Host " [OK] Saleor API is ready!" -ForegroundColor Green # --- 4. Create admin & populate sample data ---------------------------------- Write-Host "`n[4/5] Creating admin account & populating sample data..." -ForegroundColor Yellow $adminScript = "from django.contrib.auth import get_user_model; U=get_user_model(); U.objects.filter(email='admin@example.com').exists() or U.objects.create_superuser('admin@example.com', 'admin')" docker exec cve_saleor_api python manage.py shell -c $adminScript if ($LASTEXITCODE -eq 0) { Write-Host " [OK] Admin: $AdminEmail / $AdminPassword" -ForegroundColor Green } else { Write-Host " [WARN] Admin step had issues - continuing anyway." -ForegroundColor Yellow } Write-Host " Populating products/channels (may take ~1 min)..." -ForegroundColor Cyan docker exec cve_saleor_api python manage.py populatedb 2>$null | Out-Null Write-Host " [OK] populatedb done" -ForegroundColor Green # --- 5. Seed victim PII data ------------------------------------------------- Write-Host "`n[5/5] Seeding victim accounts and orders with PII..." -ForegroundColor Yellow python -m pip install requests --quiet $env:PYTHONIOENCODING = "utf-8" python scripts\seed_data.py if ($LASTEXITCODE -ne 0) { Write-Host " [ERROR] seed_data.py failed. See messages above." -ForegroundColor Red exit 1 } # --- Done -------------------------------------------------------------------- Write-Host "" Write-Host "======================================================" -ForegroundColor Green Write-Host " Lab is ready!" -ForegroundColor Green Write-Host "------------------------------------------------------" -ForegroundColor Green Write-Host " Saleor API : http://localhost:8000/graphql/" -ForegroundColor Green Write-Host " Dashboard : http://localhost:9000" -ForegroundColor Green Write-Host " Admin login : $AdminEmail / $AdminPassword" -ForegroundColor Green Write-Host "------------------------------------------------------" -ForegroundColor Green Write-Host " Run PoC:" -ForegroundColor Green Write-Host " cd scripts" -ForegroundColor Green Write-Host " python poc_cve_2026_24136.py explain" -ForegroundColor Green Write-Host " python poc_cve_2026_24136.py enumerate" -ForegroundColor Green Write-Host " python poc_cve_2026_24136.py file order_ids.json" -ForegroundColor Green Write-Host "------------------------------------------------------" -ForegroundColor Green Write-Host " Cleanup: docker compose down -v" -ForegroundColor Green Write-Host "======================================================" -ForegroundColor Green