ImperiumAI is an AI-Based Red Teaming Framework for security testing of Large Language Models that control Smart-Home / IoT systems. It combines a multi-agent adversarial system, a policy engine, IoT simulation, and risk scoring into a single, presentable diploma artefact.
ImperiumAI is a research-grade red-teaming framework that attacks an LLM-controlled smart home from the inside. Five autonomous adversarial agents take turns trying to break the home, while a policy engine evaluates every action and a risk engine quantifies the damage. The whole pipeline streams to a Next.js + Three.js front-end where a 3D battle arena visualises what is happening in real time.
LLMs are increasingly embedded into IoT control surfaces (Alexa, Google Home, custom assistants). These systems trust natural-language input that an attacker controls. Existing security tooling does not stress-test LLMs in this physical-impact context.
ImperiumAI addresses the gap by combining classical red-team methodology with LLM-specific attack vectors (prompt injection, context poisoning, privilege escalation, gradual boundary erosion, network-level injection).
The framework has 6 cooperating modules:
┌────────────────────────────────────────────────────────────────────┐
│ Next.js + React + Three.js (Battle, Dashboard, Documentation) │
└────────────────────────▲───────────────────────────────────────────┘
│ WebSocket /ws (live events)
┌────────────────────────┴───────────────────────────────────────────┐
│ FastAPI backend │
│ ┌──────────┐ ┌─────────┐ ┌───────────┐ ┌────────┐ ┌────────┐ │
│ │ Agents │→→│ LLM │→→│ Policy │→→│ IoT │→→│ Risk │ │
│ │ (5) │ │ Router │ │ Engine │ │ Sim │ │ Engine│ │
│ └──────────┘ └─────────┘ └───────────┘ └────────┘ └────────┘ │
│ ▲ │
│ │ Attack memory (SQLite) │
└────────────────────────────────────────────────────────────────────┘Assets: physical safety (locks, alarms, water valves), privacy (cameras, baby monitor, voice assistant), connectivity (router, DNS).
Adversary: remote attacker controlling user-supplied prompts to the LLM gateway.
Attack surface: any text that ultimately reaches the LLM — chat, voice transcription, sensor labels, network metadata.
Out of scope: hardware exploits, physical access, supply-chain compromise of the IoT firmware.
Tactics are derived from the OWASP LLM Top-10 + classic network red-team techniques.
| Tactic family | Examples | Detection difficulty |
|---|---|---|
| Prompt Injection | direct_injection, instruction_override, nested_injection, delimiter_confusion | Low–Medium |
| Context Manipulation | role_confusion, context_poisoning, memory_poisoning, semantic_drift | Medium–High |
| Privilege Escalation | admin_impersonation, token_forgery, sudo_injection, permission_bypass | Medium |
| Boundary Erosion | incremental_trust, boundary_erosion, jailbreak_roleplay | High |
| Network MITM | dns_spoofing, mitm_interception, arp_poisoning, traffic_injection | Medium |
The framework can talk to multiple LLM back-ends through LLMRouter: OpenAI GPT-4o, Google Gemini, DeepSeek and a built-in deterministic simulation provider. The simulation provider is the default for the diploma demo because it removes API keys / network dependencies from the defence loop.
backend/security/policy_engine.py uses 25+ regex patterns to detect injection markers, plus a list of dangerous (action, target) pairs. Critical combos (unlock + smart_lock, change_dns + router, …) escalate severity.
A novel feature is the tactic stealth profile: subtle tactics like incremental_trust have a non-zero probability of slipping past pattern detection. Each successful block hardens the engine for future rounds.
19 simulated devices with safe defaults and a curated set of allowed / dangerous actions. Each device has a 3D position, a colour, a risk level (1–5) and a written cybersecurity rationale.
| Device | Risk | Dangerous actions | Why it matters |
|---|---|---|---|
| 🚪 Front Door | 5 | unlock | Physical entry point – an unauthorised unlock leads to direct intrusion. |
| 🔐 Smart Lock | 5 | unlock_without_auth | Auth bypass on a smart lock is a textbook IoT prompt-injection target. |
| 🅿️ Garage Door | 5 | open | Opens a secondary physical entry path; bypasses house alarm zones. |
| 🪟 Window Sensor | 3 | disable | Disabling intrusion sensors gives attackers stealth movement inside the home. |
| 🚶 Motion Sensor | 3 | disable | Motion detection bypass disables behavioural anomaly signals. |
| 🚨 Smoke Detector | 4 | disable, silence | Safety-of-life device – attacking it endangers occupants directly. |
| 📹 Camera System | 4 | disable_recording, disable | Privacy & evidence – disabling recording erases the attack trail. |
| 👶 Baby Monitor | 5 | disable_audio, disable | Critical privacy device – muting audio enables stealth eavesdropping or worse. |
| 🛡️ Security Panel | 5 | disarm | Master security state – disarming exposes the whole home. |
| 🔔 Alarm | 4 | silence, disable | Silencing the alarm during a breach prevents alerting the user/operator. |
| 🌡️ Thermostat | 3 | set_extreme_temperature | Extreme temperature attacks can damage property, plants, pets. |
| 💧 Water Valve | 4 | open_valve | Flooding attacks via IoT valves are documented in real-world incidents. |
| ⚡ Power Meter | 4 | overload | Grid-edge attack surface; overload events can cascade beyond the home. |
| 💡 Lights | 1 | on (during attack window) | Used in coordinated attacks (signal masking, intimidation). |
| 📺 Smart TV | 3 | execute_hidden_command | TVs have microphones and cameras — perfect for surveillance pivoting. |
| 🔊 Smart Speaker | 3 | execute_hidden_command | Ultrasonic / hidden-command injection bypasses user awareness. |
| 🎙️ Voice Assistant | 4 | execute_hidden_command | Primary command surface for an LLM-driven home — hijacks the whole system. |
| 🤖 Vacuum Robot | 2 | map_home, move_to_restricted_area | Robots leak floor maps and can physically pivot into restricted rooms. |
| 📡 Router | 5 | change_dns, dns_spoof, open_port, disable_firewall | Gateway compromise breaks every other defence – DNS rewriting, MITM. |
Each round mutates a single 0–100 risk score. Levels:
The same score also drives reactive visual effects in the 3D scene — so a viewer can immediately tell how badly the home is doing.
The backend emits a deterministic sequence per round:
The Battle page is a 3-column live cockpit:
Every WebSocket event is captured into the corresponding tab so a viewer can answer the diploma's seven core questions at a glance:
Two interactive defenses are available during a battle:
Both have visible UI cooldowns to keep gameplay fair.
The dashboard / batch-battles endpoint runs N independent battles to study aggregate behaviour:
The Dashboard renders these metrics live:
Backend
cd backend pip install -r requirements.txt uvicorn main:app --reload --port 8000
Frontend
cd frontend npm install npm run dev # open http://localhost:3000/battle
ImperiumAI ships without any third-party GLB models. Both 3D scenes — the landing-page hero (components/HomeHero3D.jsx) and the Battle scene (components/SmartHome3D.jsx) — are fully procedural, generated at runtime from primitive Three.js geometries. No proprietary or NoAI-restricted assets are credited.
| Component | Type | Source | License |
|---|---|---|---|
| HomeHero3D | Procedural Three.js scene (landing page) | Original — written for ImperiumAI | Project license |
| SmartHome3D | Procedural Three.js scene (Battle page) | Original — written for ImperiumAI | Project license |
| SceneTooltip | DOM overlay tooltip for the 3D scene | Original — written for ImperiumAI | Project license |
| Icon set | lucide-react | https://lucide.dev/ | ISC |
| Charts | recharts | https://recharts.org/ | MIT |
| Three.js stack | @react-three/fiber, drei, postprocessing | https://github.com/pmndrs | MIT |