An interactive web application demonstrating common web vulnerabilities (OWASP Top 10) with educational remediation examples. This project showcases both offensive and defensive cybersecurity concepts.
This project consists of two main components:
A sandboxed environment where users can explore and exploit pre-built vulnerabilities:
- SQL Injection - Bypass authentication via malicious input
- Stored XSS - Inject malicious scripts via user comments
- Broken Access Control (IDOR) - Access unauthorized user profiles
An admin-only section demonstrating secure coding practices:
- Side-by-side code comparisons (vulnerable vs. secure)
- Detailed vulnerability explanations
- Remediation techniques and best practices
- Interactive Exploitation: Hands-on experience with real vulnerabilities
- Educational Content: Learn both attack vectors and defenses
- Code Examples: Compare vulnerable and secure implementations
- Modern Stack: Built with Flask, SQLite, and Bootstrap
- Detailed Documentation: Comprehensive explanations of each vulnerability
- Backend: Flask (Python 3.8+)
- Database: SQLite
- Frontend: HTML5, CSS3, JavaScript, Bootstrap 5
- Template Engine: Jinja2
- Python 3.8 or higher
- pip (Python package manager)
- Virtual environment (recommended)
- Clone the repository
git clone https://github.com/mightbeian/vulnerability-playground.git
cd vulnerability-playground- Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Initialize the database
python init_db.py- Run the application
python app.py- Access the application
- Open your browser and navigate to:
http://127.0.0.1:5000
Regular Users (for testing vulnerabilities):
- Username:
user1| Password:password123 - Username:
user2| Password:password456
Admin Access (for Remediation Dashboard):
- Username:
admin| Password:admin123
- Navigate to the login page
- Try payload:
' OR 1=1; --in the username field - Leave password blank and submit
- Login as a regular user
- Go to the Comments page
- Post:
<script>alert('XSS!');</script> - Refresh the page to see the script execute
- Login as
user1 - Access your profile at
/profile/1 - Change URL to
/profile/2to view another user's data
- Login as admin
- Access the Remediation Dashboard
- View vulnerable vs. secure code comparisons
- Read detailed explanations and best practices
Description: Injection of malicious SQL commands through user input
Impact:
- Authentication bypass
- Data exfiltration
- Database manipulation
Remediation: Use parameterized queries/prepared statements
Description: Injection of malicious scripts that execute in victims' browsers
Impact:
- Session hijacking
- Credential theft
- Malware distribution
Remediation: Input validation and output encoding
Description: Direct access to resources without proper authorization checks
Impact:
- Unauthorized data access
- Privacy violations
- Data manipulation
Remediation: Implement proper authorization checks
vulnerability-playground/
โ
โโโ app.py # Main Flask application
โโโ init_db.py # Database initialization script
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
โ
โโโ templates/ # HTML templates
โ โโโ base.html
โ โโโ index.html
โ โโโ login.html
โ โโโ comments.html
โ โโโ profile.html
โ โโโ admin_login.html
โ โโโ dashboard.html
โ
โโโ static/ # Static files
โ โโโ css/
โ โ โโโ style.css
โ โโโ js/
โ โโโ main.js
โ
โโโ docs/ # Documentation
โ โโโ README.md
โ โโโ ARCHITECTURE.md
โ โโโ EXPLOITATION_GUIDE.md
โ โโโ DEMO_WALKTHROUGH.md
โ
โโโ database/ # SQLite database (generated)
โโโ vulnerable.db
- NEVER be deployed to a production environment
- NEVER be exposed to the public internet
- ONLY be used in isolated, local development environments
- ONLY be used for educational and training purposes
After working with this project, you should understand:
- How common web vulnerabilities work
- The impact of insecure coding practices
- Proper remediation techniques
- Secure coding best practices
- The importance of input validation and output encoding
- Proper authentication and authorization implementation
Contributions are welcome! Feel free to:
- Add new vulnerability examples
- Improve documentation
- Enhance the UI/UX
- Fix bugs
Please submit a pull request with a clear description of your changes. See CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Christian Paul Cabrera
- GitHub: @mightbeian
- LinkedIn: mightbeian
- OWASP Top 10 Project
- Flask Documentation
- Web Security Community
- OWASP Top 10
- PortSwigger Web Security Academy
- Flask Security Best Practices
- OWASP Cheat Sheet Series
For detailed documentation, see the docs/ directory:
- Setup Guide - Detailed installation instructions
- Architecture - Technical design overview
- Exploitation Guide - Detailed attack techniques
- Demo Walkthrough - Step-by-step tutorial
- Contributing - Contribution guidelines
โญ If you find this project helpful for learning web security, please consider giving it a star!