SQL Injection (SQLi)
SQL Injection is one of the most dangerous and common web vulnerabilities. It allows attackers to interact directly with a website's database by injecting malicious SQL statements into input fields.
How It Works
Many websites use SQL to manage user data. If user inputs are not properly sanitized, an attacker can manipulate a query
Types of SQL Injection
- Classic SQLi: Simple payloads in inputs to manipulate queries.
- Blind SQLi: The app doesn’t show results directly, so attackers rely on true/false responses or timing.
- Error-Based SQLi: The database error messages reveal data or structure.
- Union-Based SQLi: Uses the UNION operator to fetch data from other tables.
Protection Techniques
- Always use prepared statements or parameterized queries.
- Never trust user input.
- Use input validation and allow only expected characters.
- Implement least privilege for database users.
- Monitor and log SQL errors or unusual activity.
Tools for Testing
- sqlmap
- Burp Suite
- Havij (not recommended for professional use)