Prerequisites
Before you begin, ensure you have the following installed:Python 3.x
Required to run the Flask application
Git
Version 2.x or higher for cloning the repository
VS Code
Recommended code editor for development
Modern Browser
Chromium or Edge for testing
MacOS Users: You may have
pip3 instead of pip. Run pip show pip and pip3 show pip to check which command is configured on your system.Installation
Install Dependencies
Install Python packages
- Flask - Web framework
- Flask-CORS - Cross-origin resource sharing (intentionally permissive)
- Flask-CSP - Content Security Policy headers (not implemented in base app)
- Flask-WTF - CSRF protection (not implemented in base app)
- Flask-Limiter - Rate limiting (not implemented in base app)
- bcrypt - Password hashing (not implemented in base app)
- pyotp - Two-factor authentication (not implemented in base app)
- qrcode - QR code generation for 2FA (not implemented in base app)
Many security libraries are included in
requirements.txt but are not used in the vulnerable base application. Part of your learning is to implement these security features.Access the Application
Open your browser and navigate to one of these URLs:
- Local access: http://localhost:5000 or http://127.0.0.1:5000
- Network access:
http://{YOUR_LAN_IP}:5000(e.g., http://192.168.1.100:5000)
If your teacher is hosting the app, you’ll access it via their LAN IP address instead of localhost.
Application Structure
Once running, you’ll see a simple progressive web app with the following pages:Application Pages
Key Routes
The Flask application (main.py) defines these routes:
main.py:46-67
Database Structure
The application uses SQLite with two tables:- users table
- feedback table
- Passwords stored in plaintext
- No password complexity requirements
- No unique constraints
Testing the Application
Create a Test Account
Navigate to Signup
Click the Sign Up link on the login page or go to
http://127.0.0.1:5000/signup.htmlRegister a User
Example test credentials
The date of birth field is collected but never used - this is a privacy issue (unnecessary data collection).
Begin Security Testing
Now that the app is running, you can start testing for vulnerabilities:SQL Injection
Try
' OR '1'='1 in the username fieldXSS Attack
Submit
<script>alert('XSS')</script> in the feedback formCSRF Attack
Create a malicious form that submits to the app
Open Redirect
Test
/?url=https://evil.com in the URLConfiguration Details
The app runs with these (insecure) configurations:main.py:70-73
debug=True- Exposes detailed error messages and interactive debuggerhost="0.0.0.0"- Binds to all network interfaces (should use127.0.0.1for local dev)- No secret key configured
- No HTTPS/SSL
- No rate limiting
Troubleshooting
Port 5000 already in use
Port 5000 already in use
Error message
- Stop any other Flask applications running
- Or modify
main.pyline 73 to use a different port:app.run(debug=True, host="0.0.0.0", port=5001)
Module not found error
Module not found error
Error message
- Ensure you ran
pip install -r requirements.txt - Check you’re using the correct Python environment
- Try
pip3 install -r requirements.txton MacOS/Linux
Database errors
Database errors
Error message
- The database should be created automatically in
database_files/database.db - Check that the
database_files/directory exists - If needed, create the tables manually using the schema in the Architecture documentation
Cannot access from another computer
Cannot access from another computer
Issue: You’re trying to access the app from another device on your network but it’s not working.Solution:
- Ensure Flask is running with
host="0.0.0.0"(default in this app) - Find your local IP:
ipconfig(Windows) orifconfig(Mac/Linux) - Access via
http://{YOUR_IP}:5000 - Check firewall settings allow incoming connections on port 5000
Next Steps
Deployment Guide
Set up proper sandbox environments for secure testing
Architecture Overview
Understand the application structure and components
Testing Approaches
Learn white-box, grey-box, and black-box testing
Vulnerabilities
Start exploring specific security flaws
