SQLi
What is SQLi?
SQL Injection (SQLi) is a security vulnerability that allows attackers to inject malicious SQL code into queries sent to a database. This can lead to unauthorized access to data, data manipulation, or even full control over the database. SQL is a standard language for managing data held in relational database management systems (RDBMS), including MySQL, Oracle, SQL Server, and others.

Index
Basis to tackle SQLi (Below)
Basics of SQL
An SQL query is a command used to get data out of a database.
Basic SQL syntax:
SELECTExtracts data from the given table.
--Comments out the remainder of the line. The code after--is ignored.
ORDER BYOrders the results obtained from SELECT in a specific manner. For example, if one has a table of countries and their populations, one can select the countries starting with the letter R and then order them by their population.
UNIONclause allows you to group multiple queries together.
JOINJoins data from two tables depending on a certain characteristic on the table. For example, if there's a table with customer IDs and their addresses and another table with customer IDs and their purchases, you can join both tables so that the customer addresses match their purchases.
DELETE, INSERTAllows you to delete data or add new data to a table.
AND, ORAllows you to modify queries so that they return information depending on multiple categories.
MIN, MAXThey return the smallest or largest value of a query.
User input from textbox, URL parameters, etc may be used to construct a SQL query in the backend.
Code below directly adds in input as a part of the query, as a result, the attacker can 'inject' their own code here and execute it.
Last updated