SQL Injection – Insecure Demo ← Return to Demo Hub

Login

Feedback (SQL Injection)

How This Page is Vulnerable

This demo page is intentionally vulnerable to SQL Injection, showcasing both:


🔐 Login Form (Form 1)

This form is meant to simulate a basic login system that is vulnerable to SQL Injection.

It uses the following insecure query:

$sql = "SELECT * FROM sqlbad WHERE username = '$username' AND password = '$password'";

This query directly includes user input without sanitization, allowing attackers to inject SQL code.

🚨 Example Login Injections:

---

💬 Feedback Form (Form 2)

This form demonstrates a Second Order SQL Injection, where the attacker inputs SQL code as “feedback.”

Insecure code looks like:

$sql = "INSERT INTO sqlbad (username, password) VALUES ('$feedbackUsername', '$feedback');";

This allows an attacker to inject arbitrary SQL commands by manipulating the feedback input.

🔥 Example Injection Payload:

INSERT INTO sqlbad (username, password) VALUES ('attackerno', '1234'); --

This will insert a brand new user into the sqlbad table without any authorization check.

---

🧠 Summary

⚠️ Reminder: These vulnerabilities are intentional for learning purposes. Never use such code in production!