SQL_Injection_Notes
SQL_Injection_Notes
Live Example
What is SQL Injection?
SQL Injection (SQLi) is a code injection technique that allows an attacker to interfere with
the queries that an application makes to its database. It occurs when user input is
improperly sanitized and directly included in SQL queries. This can allow an attacker to
view, modify, or delete data, and in some cases, even gain control over the server.
User Input:
Username: admin' --
Password: (leave it blank)
Resulting Query:
SELECT * FROM users WHERE username = 'admin' --' AND password = '';
The part after '--' is treated as a comment in SQL, so the password check is ignored. This
allows the attacker to log in without knowing the correct password.
Conclusion
SQL Injection is one of the most dangerous vulnerabilities in web applications.
Understanding how it works is essential for developers and cybersecurity professionals.