How does SQL injection work?
SQL injection (or SQLi) is a vulnerability that allows arbitrary SQL code to be inserted to read, modify, or delete data and interact with the application’s underlying database.
SQL injection works by exploiting the way user input is used in functions that connect to a SQL database by directly concatenating or chaining user input to the SQL statement or using the input as part of a parameter in a prepared statement. If we manage to alter the query semantics to make the database do something unintended such as read, modify, or delete different data or execute commands, we have SQL injection.
SQL injection types
As defined in the OWASP Web Security Testing Guide in Testing for SQL Injection [9], we can consider three classes of SQL injection according to the type of channel used to get some output:
- In-band: We receive our output directly into the web application
- Out-of-band: We receive our output on a different channel (e.g., email...