The Vault is a gamified educational platform built for Google's Prompt Wars. It teaches developers and security researchers how to identify and mitigate prompt injection vulnerabilities in Large Language Models (LLMs) through a series of 5 progressively hardened security challenges.
In the era of Generative AI, prompt injection has emerged as the #1 vulnerability (OWASP LLM01). The Vault addresses this critical real-world problem by providing a safe, interactive laboratory to understand adversarial attacks and defensive engineering.
Our approach follows a "Defense-in-Depth" philosophy, moving beyond simple keyword blocking to sophisticated structural and logical validation.
- Adversarial Emulation: Users act as "Red Teamers," learning common exploits like payload splitting, social engineering, and delimiter hijacking.
- Multi-Layered Defense: Each level introduces a new defensive primitive, mimicking real-world production safeguards.
- Educational Feedback: The system doesn't just block; it utilizes a "Judge AI" to explain why a leak occurred (Level 4) and provides a terminal-inspired UI to keep users engaged.
- Frontend: Next.js 14 (App Router) + Tailwind CSS + Lucide Icons for a high-fidelity "Hacker-Chic" terminal experience.
- Backend: Python 3.11+ using FastAPI, optimized for Vercel Serverless Functions.
- AI Inference: Google Gemini 1.5 Flash (Primary) + Llama 3 (Secondary/Judge) for state-of-the-art inference and adversarial logic.
- Validation: Pydantic for strict type safety and a salted rolling-hash checksum for game state integrity.
| Level | Name | Defense Logic | Psychological/Technical Target |
|---|---|---|---|
| 1 | The Intern | No Constraints | Direct requests. Demonstrates naive AI behavior. |
| 2 | The Guard | Negative Constraints | Social Engineering. Tests persistence against simple instructions. |
| 3 | The Filter | Regex + Fuzzy Matching | Obfuscation. Detects creative spelling (e.g., V3NUS-7) using Levenshtein distance. |
| 4 | The Judge | Dual-LLM Defense | Indirect leaks. A secondary "Judge AI" evaluates the primary output for leaked secrets. |
| 5 | The Architect | Structural Sandboxing | Delimiter Hijacking. Uses AST-like validation to prevent users from "escaping" the prompt sandbox. |
- Developer Training: Helps teams build more secure LLM applications by understanding how injection works.
- Security Auditing: Provides a benchmark for testing the robustness of internal system prompts.
- Inclusive Design: Built with A+ Accessibility (Full ARIA compliance, screen reader announcements, and keyboard-first navigation) to ensure the lab is accessible to all.
- Google Gemini is the primary AI service. The
GEMINI_API_KEYis required for the core challenge logic. Groq (GROQ_API_KEY) is used only as a fallback inference engine for the Judge AI at Level 4. - Stateless backend: Rate limiting is in-memory (per serverless instance). For production scale, a Redis-backed store is recommended.
- Game state in localStorage: No user accounts or server-side session storage. Progress is stored client-side only.
- Security is educational, not production-grade: The vault keys are intentionally "extractable" — the challenge is teaching prompt injection, not storing real secrets.
- Node.js 18+ and Python 3.11+ are available on the developer's machine.
- Node.js 18+
- Python 3.11+
- Google Gemini API Key (
GEMINI_API_KEY) — required for primary AI - Groq API Key (
GROQ_API_KEY) — used as fallback for the Judge AI (Level 4)
-
Clone the Repo
git clone https://github.com/mathuryashash/hekcer.git cd hekcer -
Backend Setup
pip install -r requirements.txt # Create a .env.local file and add: # GEMINI_API_KEY=your_gemini_key_here # GROQ_API_KEY=your_groq_key_here uvicorn api.index:app --reload --port 8000
-
Frontend Setup
npm install npm run dev
Run our exhaustive test suite of 72 tests to verify security logic:
pytest test_api.pyThe application is optimized for Vercel.
- Push to GitHub.
- Connect to Vercel.
- Add
GROQ_API_KEYto Environment Variables. - Deploy.
The project includes:
- Rate Limiting: Sliding window algorithm (5 req/sec) to prevent brute force.
- State Checksum: Rolling hash to prevent
localStoragemanipulation. - Input Sanitization: Strips control characters and enforces length limits.
Built with ❤️ for Google's Prompt Wars by Yashash Mathur.