7. Lab Setup and Environmental Safety

7.1 Introduction
Why This Matters
Key Concepts
Theoretical Foundation
Why This Works (Model Behavior)
Chapter Scope
7.2 Secure Lab Architecture
Isolation Strategies: Docker vs. Virtual Machines
Isolation Method
Pros
Cons
Best For
How Network Isolation Works

Mechanistic Explanation
Detailed Network Isolation Implementation
Docker-Based Isolation (Recommended)
Attacker Workstation Dockerfile
Starting the Lab
VM-Based Isolation
VirtualBox Setup (No GPU Support)
Proxmox/QEMU Setup (GPU Passthrough Possible)
Firewall Rules (iptables)
7.3 Hardware & Resource Planning
Local Hardware Requirements
Model Size
Precision (Bit-depth)
VRAM Requirement
Hardware Strategy
Local vs. Cloud (RunPod / Vast.ai)
7.4 Local LLM Deployment
Inference Engines

Practical Example: Setting up vLLM for Red Teaming
What This Code Does
Option A: Ollama (Recommended for Beginners)
Installation (Ollama)
Pulling Test Models
Running the Ollama Server
Python Integration
Option C: Text-Generation-WebUI (Full GUI)
Option D: llama.cpp (Lightweight, Portable)
7.5 Practical Tooling: The Attack Harness
Core Python Environment
Garak (The LLM Vulnerability Scanner)
Practical Example: harness.py
harness.py
What This Code Does
Key Components
Success Metrics
7.6 Operational Safety and Monitoring
Detection Methods
Detection Method 1: Financial Anomaly Detection
Detection Method 2: Resource Spikes
Mitigation and Defenses
Defense Strategy: The Kill Switch

Comprehensive Kill Switch Script
Watchdog Timer
Rate Limiter
Cost Tracking System
Engagement Budget Template
7.7 Advanced Techniques
GPU Passthrough for Maximum Isolation
Simulating Multi-Agent Systems
7.8 Research Landscape
Seminal Papers
Paper
Year
Contribution
Current Research Gaps
7.9 Case Studies
Case Study 1: The "Denial of Wallet" Loop
Incident Overview
Attack Timeline
Lessons Learned
Case Study 2: The Data Leak
Incident Overview
Key Details
Lessons Learned
7.10 Conclusion
Chapter Takeaways
Next Steps
Appendix A: Pre-Engagement Checklist
Lab Readiness
Appendix B: Post-Engagement Checklist
Cleanup
Last updated
Was this helpful?

