This is a 🚧WIP🚧 Capture The Flag (CTF) application designed to teach prompt injection in multi-chain LLM applications. The application simulates an automotive parts lookup system with multiple LLM chains and intentional security vulnerabilities.
The system contains multiple flags:
- 3 flags discoverable via prompt injection techniques
- 2 flags discoverable through other security bypass methods
All flags follow the format realflag={flag_text}
or realflag=flag_text
.
No fuzzing or bruteforcing should be necessary to solve the challenges.
- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Run the application:
python main.py
The application will be available at http://localhost:8001.
Note: You'll need to provide your OpenAI API key in the application UI.
-
Make sure you have Docker and Docker Compose installed on your system.
-
Create a
.env
file with your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_here
- Build and run the Docker container:
docker-compose up -d
- To stop the application:
docker-compose down
The application will be available at http://localhost:8001.
Note: You'll need to provide your OpenAI API key in the application UI as well
main.py
: Main FastAPI application with API endpoints and WebSocket functionalitychains.py
: LLM chain definitions with intentional vulnerabilitiesparts_db.py
: Mock parts database with sensitive informationemployee_db.py
: Employee database with sensitive informationengineering_notes.py
: Engineering notes with historical datastatic/
: Static assets for the web interface
The application uses multiple LLM chains, creating potential for prompt injection attacks across chain boundaries.
The UI includes a flag submission and tracking system that validates captured flags.
This application uses:
- OpenAI GPT-3.5-turbo model for generating responses
- LangChain for managing LLM chains and prompts
This application is designed for educational purposes only. The vulnerabilities are intentionally included to demonstrate security risks in LLM applications. Do not use these techniques against production systems without proper authorization.
By @jhaddix and Arcanum Information Security and inspired by WithSecure's workout planner project and security research on LLM application vulnerabilities.