BadBank is a deliberately insecure web application that simulates an online banking platform. It contains multiple security vulnerabilities commonly found in web applications, making it an excellent tool for:
- Security training and education
- Penetration testing practice
- Vulnerability assessment learning
- Secure coding awareness
- OWASP Top 10 demonstration
BadBank contains 16+ intentional vulnerabilities covering all OWASP Top 10 2021 categories:
- SQL Injection - Authentication bypass and data extraction
- Cross-Site Scripting (XSS) - Stored, reflected, and DOM-based
- Insecure Direct Object References (IDOR) - Unauthorized access to resources
- Cross-Site Request Forgery (CSRF) - Unauthorized actions
- Business Logic Flaws - Negative balances, race conditions
- Authentication Issues - Plaintext passwords, no rate limiting
- Security Misconfigurations - Debug mode, CORS issues
- Information Disclosure - Error messages, predictable IDs
For detailed vulnerability descriptions, see VULNERABILITIES.md.
- Backend: Flask (Python)
- Database: SQLite
- Frontend: HTML/CSS with minimal JavaScript
- Authentication: Session cookies (insecure implementation)
- Python 3.7 or higher
- pip (Python package manager)
git clone <repository-url>
cd badbank# Create virtual environment
python -m venv badbank-env
# Activate virtual environment
# On Windows:
badbank-env\Scripts\activate
# On macOS/Linux:
source badbank-env/bin/activatepip install -r requirements.txtThe SQLite database will be automatically created when you first run the application.
python app.pyThe application will start on http://localhost:5000
BadBank comes with three pre-configured test accounts:
| Username | Password | User ID | Account Number | Initial Balance |
|---|---|---|---|---|
| alice | password123 | 1 | 1001-2001-3001 | $5,000.00 |
| bob | password123 | 2 | 1001-2002-3002 | $3,500.00 |
| charlie | password123 | 3 | 1001-2003-3003 | $7,500.00 |
Note: Passwords are stored in plaintext (intentional vulnerability).
- Home Page (
/) - Application overview and navigation - Registration (
/register) - Create new user accounts - Login (
/login) - Authenticate with existing credentials - Dashboard (
/dashboard) - View account balance and recent transactions - Transfer Money (
/transfer) - Send money between accounts - Transaction History (
/transactions) - View all transactions - Profile (
/profile) - Update user information - Password Reset (
/reset-password) - Reset forgotten passwords
Username: admin' OR '1'='1' --
Password: anything
Description: <script>alert('XSS')</script>
- Modify the hidden
sender_user_idfield in transfer forms - Access other users' transactions:
/transactions?user_id=2
/reset-password?message=<script>alert('XSS')</script>
For complete exploitation examples, see EXPLOITS.md.
badbank/
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── README.md # This file
├── VULNERABILITIES.md # Detailed vulnerability descriptions
├── EXPLOITS.md # Exploitation examples and PoCs
├── FIXES.md # Security mitigation strategies
├── database/
│ └── init.sql # Database schema and seed data
├── static/
│ ├── css/
│ │ └── style.css # Application styles
│ └── js/
│ └── main.js # Client-side JavaScript (vulnerable)
└── templates/
├── base.html # Base template
├── index.html # Home page
├── login.html # Login form
├── register.html # Registration form
├── dashboard.html # User dashboard
├── transfer.html # Money transfer form
├── transactions.html # Transaction history
├── profile.html # User profile
└── reset_password.html # Password reset form
BadBank exposes several API endpoints for testing:
GET /api/user/<id>- Retrieve user information (IDOR vulnerability)GET /api/search?q=<query>- Search functionality (XSS vulnerability)
Recommended tools for testing BadBank:
- Burp Suite - Web application security testing
- OWASP ZAP - Automated vulnerability scanning
- SQLMap - SQL injection testing
- curl - Command-line HTTP testing
- Browser Developer Tools - Client-side testing
- VULNERABILITIES.md - Detailed vulnerability analysis
- EXPLOITS.md - Step-by-step exploitation guide
- FIXES.md - Secure coding solutions
After using BadBank, learners should understand:
- Common Web Vulnerabilities - How they occur and their impact
- Attack Techniques - Practical exploitation methods
- Security Testing - How to identify vulnerabilities
- Secure Coding - How to prevent vulnerabilities
- Risk Assessment - Understanding business impact
Database Errors
# Delete existing database and restart
rm badbank.db
python app.pyPort Already in Use
# Change port in app.py or kill existing process
lsof -ti:5000 | xargs kill -9 # macOS/Linux
netstat -ano | findstr :5000 # WindowsModule Import Errors
# Ensure virtual environment is activated and dependencies installed
pip install -r requirements.txt- Educational Use Only - BadBank is designed exclusively for educational purposes
- No Production Use - Never deploy this application in a production environment
- Authorized Testing Only - Only test against your own installations
- Legal Compliance - Ensure all testing complies with local laws and regulations
- Responsible Disclosure - If you find additional vulnerabilities, report them responsibly
✅ Allowed:
- Educational training and learning
- Security awareness demonstrations
- Penetration testing practice on your own systems
- Academic research and coursework
- Security tool development and testing
❌ Prohibited:
- Testing against systems you don't own
- Unauthorized access to any systems
- Malicious use of discovered techniques
- Production deployment
- Sharing credentials or access with unauthorized parties
If you discover additional vulnerabilities or have suggestions for improvement:
- Document the vulnerability thoroughly
- Provide proof-of-concept code
- Explain the educational value
- Submit via appropriate channels
For questions, issues, or discussions about BadBank:
- Check existing documentation first
- Review the troubleshooting section
- Ensure you're using BadBank for authorized educational purposes
This project is released for educational purposes only. Users are responsible for ensuring their use complies with all applicable laws and regulations.
Remember: The goal of BadBank is to learn about security vulnerabilities in a safe, controlled environment. Always practice responsible disclosure and ethical security testing.