Skip to content

mightbeian/vulnerability-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ” Vulnerability Playground & Remediation Dashboard

Python Flask License

An interactive web application demonstrating common web vulnerabilities (OWASP Top 10) with educational remediation examples. This project showcases both offensive and defensive cybersecurity concepts.

โš ๏ธ DISCLAIMER: This application contains intentional security vulnerabilities for educational purposes only. DO NOT deploy to production or expose to the public internet.

๐ŸŽฏ Project Overview

This project consists of two main components:

1. The Playground (Offensive Security)

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

2. Remediation Dashboard (Defensive Security)

An admin-only section demonstrating secure coding practices:

  • Side-by-side code comparisons (vulnerable vs. secure)
  • Detailed vulnerability explanations
  • Remediation techniques and best practices

๐Ÿš€ Features

  • 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

๐Ÿ› ๏ธ Tech Stack

  • Backend: Flask (Python 3.8+)
  • Database: SQLite
  • Frontend: HTML5, CSS3, JavaScript, Bootstrap 5
  • Template Engine: Jinja2

๐Ÿ“‹ Prerequisites

  • Python 3.8 or higher
  • pip (Python package manager)
  • Virtual environment (recommended)

โš™๏ธ Installation

  1. Clone the repository
git clone https://github.com/mightbeian/vulnerability-playground.git
cd vulnerability-playground
  1. Create a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt
  1. Initialize the database
python init_db.py
  1. Run the application
python app.py
  1. Access the application
  • Open your browser and navigate to: http://127.0.0.1:5000

๐ŸŽฎ Usage

Default Credentials

Regular Users (for testing vulnerabilities):

  • Username: user1 | Password: password123
  • Username: user2 | Password: password456

Admin Access (for Remediation Dashboard):

  • Username: admin | Password: admin123

Exploiting Vulnerabilities

SQL Injection

  1. Navigate to the login page
  2. Try payload: ' OR 1=1; -- in the username field
  3. Leave password blank and submit

Stored XSS

  1. Login as a regular user
  2. Go to the Comments page
  3. Post: <script>alert('XSS!');</script>
  4. Refresh the page to see the script execute

IDOR (Broken Access Control)

  1. Login as user1
  2. Access your profile at /profile/1
  3. Change URL to /profile/2 to view another user's data

Viewing Remediation

  1. Login as admin
  2. Access the Remediation Dashboard
  3. View vulnerable vs. secure code comparisons
  4. Read detailed explanations and best practices

๐Ÿ“š Vulnerabilities Covered

1. SQL Injection (SQLi)

Description: Injection of malicious SQL commands through user input

Impact:

  • Authentication bypass
  • Data exfiltration
  • Database manipulation

Remediation: Use parameterized queries/prepared statements

2. Cross-Site Scripting (XSS)

Description: Injection of malicious scripts that execute in victims' browsers

Impact:

  • Session hijacking
  • Credential theft
  • Malware distribution

Remediation: Input validation and output encoding

3. Broken Access Control (IDOR)

Description: Direct access to resources without proper authorization checks

Impact:

  • Unauthorized data access
  • Privacy violations
  • Data manipulation

Remediation: Implement proper authorization checks

๐Ÿ“ Project Structure

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

๐Ÿ”’ Security Considerations

โš ๏ธ IMPORTANT: This application is intentionally vulnerable and should:

  • 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

๐ŸŽ“ Learning Objectives

After working with this project, you should understand:

  1. How common web vulnerabilities work
  2. The impact of insecure coding practices
  3. Proper remediation techniques
  4. Secure coding best practices
  5. The importance of input validation and output encoding
  6. Proper authentication and authorization implementation

๐Ÿค Contributing

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.

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘ค Author

Christian Paul Cabrera

๐Ÿ™ Acknowledgments

  • OWASP Top 10 Project
  • Flask Documentation
  • Web Security Community

๐Ÿ“š Additional Resources

๐Ÿ“– Documentation

For detailed documentation, see the docs/ directory:


โญ If you find this project helpful for learning web security, please consider giving it a star!

About

Interactive web application demonstrating OWASP Top 10 vulnerabilities with remediation examples - Educational cybersecurity project

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors