Home

SQL Injection(SQLi)

SQL injection allows an attacker to make unwanted requested queries or modifications to the database.

Let’s assume the server makes this query with user input. SELECT * FROM users WHERE = 'userInput';

If the user were to input ' OR 1=1; DROP TABLE users; -- the resulting query would be SELECT * FROM users WHERE = '' OR 1=1; DROP TABLE users; -- ';.

This attack allowed the user to drop the table when it should be allowed.

Common SQLi attacks

Logins

Bypassing logins

How do you know the website is using SQL?

How do you know which SQL database is being used?

How do you know what all the tables are in the db?

How do you know what all the columns in a table are?

Types of SQLi

Boolean based SQLi

Boolean based SQLi happen when you only get a boolean value back from your SQLi and you have to extract information through this boolean value.

Blind SQLi

Blind SQLi are where the attacker cannot see any responses, including errors, from the db.

How to prevent SQLis

SELECT * FROM products WHERE category = 'Gitfs' OR 1=1 --' - Selects products which has the category of gifts or where 1=1(which is true). This results in returning all the products regardless of the category.