Red Team vs Blue Team: Adversarial ML Combat Simulation
A comprehensive adversarial machine learning security simulation where Red Team attackers battle against Blue Team defenders in a 30-minute AI/ML security warfare scenario.
This system simulates real-world AI/ML security scenarios where:
- 🔴 Red Team launches sophisticated attacks (adversarial inputs, model extraction, evasion)
- 🔵 Blue Team deploys ML-powered defenses (anomaly detection, rate limiting, input validation)
The battle runs for 30 minutes with 10 rounds, and the final results determine whether AI/ML security systems are robust enough for modern applications.
ai-security-battle/
├── database/ # Database layer
│ ├── schema.sql # Database schema
│ ├── db_config.py # Database manager & repositories
│ ├── models.py # Data models
│ └── seed_data.py # Initialize with sample data
│
├── blue_team/ # Blue Team (Defenders)
│ ├── ml_models/ # ML models for defense
│ ├── defenses/ # Defense mechanisms
│ ├── monitoring/ # Monitoring systems
│ ├── api/ # API endpoints
│ └── blue_agent.py # Blue Team orchestrator
│
├── red_team/ # Red Team (Attackers)
│ ├── attacks/ # Attack implementations
│ ├── reconnaissance/ # Probing and scanning
│ ├── adaptation/ # Strategy adaptation
│ └── red_agent.py # Red Team orchestrator
│
├── battle_engine/ # Battle coordination
│ ├── orchestrator.py # Main battle controller
│ ├── round_manager.py # Round timing
│ ├── scoring_system.py # Score tracking
│ └── logger.py # Event logging
│
├── shared/ # Shared utilities
│ ├── config.py # Configuration
│ ├── constants.py # Constants & enums
│ └── utils.py # Utility functions
│
├── results/ # Battle results & logs
├── tests/ # Unit tests
├── docker/ # Docker configuration
├── requirements.txt # Python dependencies
├── setup.py # Package setup
├── run_battle.py # Main entry point
└── README.md # This file
cd ai-security-battle
# Create virtual environment (recommended)
python -m venv venv
venv\Scripts\activate # On Windows
# Install dependencies
pip install -r requirements.txtpython database/seed_data.py# Standard battle (30 minutes, 10 rounds)
python run_battle.py
# Quick battle (10 minutes, 5 rounds)
python run_battle.py --quick
# Custom configuration
python run_battle.py --rounds 8 --duration 20
# Initialize database and run
python run_battle.py --init- Initialization - Both teams train their models
- Rounds 1-10 - Red attacks, Blue defends
- Adaptation - Both teams adjust strategies
- Conclusion - Winner determined, report generated
- Adversarial Inputs - Craft inputs to fool ML classifier
- Model Extraction - Steal model via queries
- Evasion Attacks - Adapt to detection patterns
- Inference Attacks - Extract training data info
- Rate Limiting - Prevent API abuse
- Input Validation - Schema and range checking
- Anomaly Detection - Isolation Forest algorithm
- ML Authentication - Random Forest classifier
- Successful breach: +10 points
- Evade detection: +5 points
- Model extraction: +15 points
- Attack detected: +8 points
- Attack blocked: +12 points
- Zero breaches round: +15 points
Edit shared/config.py to customize battle settings, defense parameters, and attack configurations.
pytest tests/ -vMIT License - Educational and research purposes
Built for AI/ML Security Research & Education 🚀