Web App Security

What Is SQL Injection (SQLi)? Definition, Architecture & Defense

Quick Definition: SQL Injection (SQLi) is a critical vulnerability where user input is concatenated directly into a database query string, allowing an attacker to alter the SQL syntax and read, modify, or delete arbitrary database data.

How SQL Injection (SQLi) Works in Practice

When code builds a query via string concatenation like "SELECT * FROM users WHERE email = '" + input + "'", supplying ' OR 1=1-- breaks out of the data literal and changes the boolean logic of the WHERE clause. Attackers use UNION queries, error messages, or blind time delays to extract entire tables.

Defensive Mitigation & Hardening Checklist

Always use parameterized queries (prepared statements) where the SQL structure is compiled ahead of time and user inputs are bound strictly as non-executable parameters.

Hands-On Tool & Cheat Sheet


Related Security Glossary Terms