SQL Injection

Noun · Security & Infosec · Origin: 1998

Definitions

  1. SQL Injection is a code injection vulnerability that occurs when an attacker inserts malicious SQL statements into input fields or parameters that are incorporated into database queries without proper sanitization. When a web application naively concatenates user input directly into SQL queries, an attacker can manipulate the query logic to bypass authentication, read sensitive data from other tables, modify or delete data, and in some cases execute operating system commands on the database server. A classic example: entering ' OR '1'='1 into a login form's password field can make the query always return true, bypassing authentication entirely. SQL injection has been the top web application vulnerability for decades, appearing consistently in the OWASP Top 10. Prevention requires using parameterized queries (prepared statements) or ORM frameworks that separate SQL code from data, input validation, least-privilege database accounts, and web application firewalls. Despite being well understood and easily preventable, SQL injection continues to be exploited because developers sometimes bypass safe patterns for convenience.

    In plain English: Typing special database commands into a website's search box or login form to trick the system into giving you data it shouldn't, or letting you in without a real password.

    Example: "Entering ' OR 1=1 -- into a login form and getting admin access is the 'Hello World' of SQL injection."

Etymology

1998
Rain Forest Puppy publishes the first known SQLi write-up in Phrack
2008
Heartland Payment breach via SQLi exposes 130M cards

Related Terms