Glossary

SQL Injection

SQL Injection is an attack where a malicious actor inserts arbitrary SQL code into a query through user input. If the application concatenates it without escaping, the attacker can read any data, modify or delete it, and in some databases execute OS commands.

Classic example

The query SELECT * FROM users WHERE email = '{$email}' with input ' OR 1=1 -- becomes WHERE email = '' OR 1=1 --' — returning every user.

Defence