SQL Injection Flashcards
What’s SQL injection?
type of injection attack that targets web applications that use SQL (Structured Query Language) to interact with databases
When does SQL injection occur?
occurs when an attacker is able to manipulate or inject malicious SQL code into a web application’s database query, which is then executed by the database server
What’s the attack scenario of SQL injection?
- attacker identifies a vulnerable web application that does not properly validate or sanitize user-supplied input before incorporating it into SQL queries
- attacker exploits this vulnerability by injecting specially crafted input to manipulate the intended SQL query
What are the common targets of SQL injection?
various parts of a web application, such as user input fields (e.g., login forms, search boxes, registration forms), URL parameters, or cookies
What are the different SQL injection attack techniques?
- Union-Based SQL Injection
- attacker leverages the UNION operator to combine the results of a maliciously crafted query with the original query, allowing unauthorized access to data
- Boolean-Based SQL Injection
- attacker uses conditional statements to infer information by manipulating the logic of the SQL query
- Error-Based SQL Injection
- attacker exploits error messages or error handling mechanisms to extract information about the database structure or contents
- Time-Based SQL Injection
- attacker introduces time delays in SQL queries to infer information based on the response times
What are the potential consequences of SQL injection?
- unauthorized data disclosure, modification, or deletion
- attackers can bypass authentication mechanisms, retrieve sensitive data, or execute arbitrary SQL commands on the database server
- in some cases, an attacker can escalate privileges, gain administrative access, or execute operating system commands through the database
What is a telltale sign that attacks is a SQL injection attack and why?
- single quotation mark in the input field
- quotation mark is used to escape outside the SQL code’s input field
What mitigation techniques are used to prevent SQL injection attacks. Name 4
- stored procedures
- escaping user input
- parameterized queries
- input validation
Describe stored procedures
limit what can be done via the database server
Describe escaping user input
makes dangerous characters less likely to be a problem
Describe parameterized queries
limit what can be sent in a query
What is the character most commonly used in SQL injection attacks?
single quote character (‘) is used in SQL queries and must be handled carefully on web forms to protect against SQL injection attacks