Skip to content

An interactive Flask-based Web Security Lab showcasing real-time demonstrations of SQL Injection, Cross-Site Scripting (XSS), and Cross-Site Request Forgery (CSRF). Includes both vulnerable and secure scenarios for hands-on cybersecurity learning.

License

Notifications You must be signed in to change notification settings

subuhana2303/Web_Vulnerablity_Lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›‘οΈ Web Vulnerability Lab β€” Learn, Simulate & Secure the Web

Made by Subuhana B License: MIT Backend Database

πŸ” A safe and interactive sandbox to learn how common web vulnerabilities work β€” and how to defend against them. Built with Flask, PostgreSQL, and Bootstrap.


🧩 Overview

Web Vulnerability Lab is a security-focused educational platform that demonstrates real-world attack scenarios in a safe environment. Learn how malicious users exploit vulnerabilities like SQL Injection, Cross-Site Scripting (XSS), and Cross-Site Request Forgery (CSRF), and explore secure coding strategies to prevent them.


🌟 Key Features

βœ… SQL Injection (Vulnerable vs Secure Login)
βœ… Cross-Site Scripting (XSS via form input)
βœ… Cross-Site Request Forgery (Simulated Banking Transfer)
βœ… Real-time form input, execution logs, and code comparisons
βœ… One-click "Init Demo Data" setup for instant testing
βœ… Clean UI with Bootstrap dark mode


πŸ› οΈ Tech Stack

Layer Technology
Backend Python Flask, SQLAlchemy ORM
Frontend Jinja2 + Bootstrap 5 (Dark Theme)
Database PostgreSQL (default), SQLite (fallback)
Security CSRF Protection, Escaped Templates, Input Sanitization

πŸ“Ή Demo Walkthrough

🎬 Watch Demo Video: Click to Watch on Google Drive

πŸ–ΌοΈ Screenshots

Dashboard

Screenshot 2025-06-15 175234

SQL Injection

sql

XSS Attack Demo

image

CSRF Protected Transfer

image


πŸ“ Project Structure

WEB-VULNERABILITY-LAB/
β”œβ”€β”€ app.py # Main Flask app
β”œβ”€β”€ models.py # Database models
β”œβ”€β”€ routes.py # All route logic
β”œβ”€β”€ templates/ # HTML Templates (Jinja2)
β”œβ”€β”€ static/ # CSS/JS files
β”œβ”€β”€ screenshots/ # Screenshots for demo
β”œβ”€β”€ requirements.txt # Dependencies
└── README.md


πŸš€ Getting Started Locally

1️⃣ Clone the Repository

git clone https://github.com/subuhana2303/web-vulnerability-lab.git cd web-vulnerability-lab

2️⃣ Install Dependencies

pip install -r requirements.txt

3️⃣ Run the Flask App

python app.py ➑️ Open your browser: http://localhost:9000 πŸ§ͺ Click "Init Demo Data" to populate the app and begin exploring vulnerabilities.


🧠 Sample Payloads

πŸ”“ SQL Injection

' OR '1'='1

admin'--

' UNION SELECT 1,2,3--

🦠 XSS

<script>alert('XSS')</script>

<img src=x onerror=alert(1)>

<svg onload=alert('XSS')>

🎯 CSRF

Transfer page tested with/without tokens

Secure form prevents unauthorized requests

πŸŽ“ Learning Outcomes

Understand the mechanism behind common vulnerabilities

Differentiate between insecure and secure coding practices

Get hands-on with Flask, HTML templating, and security defenses

Learn how CSRF tokens and HTML escaping protect users

πŸ’‘ Motivation

This project was created to:

Help beginners and students learn web application security

Enable safe experimentation with real-world attacks

Support academic teaching and cybersecurity awareness


πŸ™‹πŸ»β€β™€οΈ About Me

πŸ‘©πŸ» Subuhana B

πŸ“§ [email protected]

🌐 GitHub: @subuhana2303


🀝 Contributing

Pull requests and suggestions are welcome! If you'd like to contribute enhancements, please fork the repo and submit a PR. For feature ideas or bug reports, feel free to open an issue.


⚠️ Disclaimer

This project is for educational use only. Never use these techniques in unauthorized environments. Always test within legal, ethical, and permitted boundaries.


πŸ“„ License

This project is licensed under the MIT License. You are free to fork, use, and build on it with proper credit.


About

An interactive Flask-based Web Security Lab showcasing real-time demonstrations of SQL Injection, Cross-Site Scripting (XSS), and Cross-Site Request Forgery (CSRF). Includes both vulnerable and secure scenarios for hands-on cybersecurity learning.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published