A deliberately vulnerable Django application designed to teach SQL injection techniques in a safe and controlled environment. This application simulates a CTF (Capture The Flag) style challenge similar to those found on TryHackMe or HackTheBox.
This application is intentionally vulnerable for educational purposes only. Do not deploy this in a production environment or on a publicly accessible server.This application contains multiple intentional vulnerabilities that allow you to:
- SQL Injection: Extract hidden data from the database and discover hidden tables
- Local File Inclusion (LFI): Access sensitive system files through path traversal
- Command Injection: Execute arbitrary system commands on the server
- Find multiple flags to complete the challenge
Difficulty: Medium
- Python 3.8 or higher
- Django 4.0 or higher
-
Clone this repository:
git clone https://github.com/yourusername/HMvuln.git cd HMvuln -
Install required packages:
pip install -r requirements.txt
(or simply install Django if requirements.txt is missing:
pip install django) -
Navigate to the mysite directory:
cd mysite -
Set up the database and seed it with vulnerable data:
python manage.py migrate python manage.py seed_db
-
Start the development server:
python manage.py runserver
-
Access the vulnerable applications at:
http://localhost:8000/polls/vulnerable/ # SQL Injection Challenge http://localhost:8000/polls/lfi/ # Local File Inclusion Challenge http://localhost:8000/polls/ping/ # Command Injection Challenge
- Find a way to exploit the SQL injection vulnerability
- Enumerate the database schema to discover hidden tables
- Extract the flag from the hidden table
- Submit the flag (format: FLAG{...})
- Exploit the file inclusion vulnerability to access sensitive system files
- Try to access the application's configuration files to find credentials
- Find a way to read the database file directly
- Discover the hidden flag file on the system
- Bypass the ping functionality to execute arbitrary system commands
- Enumerate the server's file system and users
- Discover environment variables and configuration details
- Find the hidden flag in the server's file system
- The application is vulnerable to SQLite injection, which has slightly different syntax than MySQL or PostgreSQL
- Try basic SQL injection techniques first (quotes, comments, UNION statements)
- Explore the SQLite system tables to discover all tables in the database
- Remember that most SQL injection cheat sheets focus on MySQL, so you may need to adapt the techniques for SQLite
- Test for basic injection with:
' OR '1'='1 - Enumerate tables with:
' UNION SELECT name, NULL FROM sqlite_master WHERE type='table' -- - Further explore discovered tables and extract the flag
- Burp Suite (Community Edition is sufficient)
- OWASP ZAP
- SQLmap (though manual exploitation is recommended for learning)
Contributions are welcome! If you'd like to improve the challenges, fix bugs, or add new features:
- Fork the repository
- Create a feature branch
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.