i take one breath / mint at a time

PortSwigger Academy Day_01

#websec #appsec #sql #portswigger #selfstudy #burpsuite

Burp Usages

SQLi: allows attacker to interfere with db queries from app

Follow-Up Question:

Impact:

Types of SQL Injection Examples:

SQL Syntax Notes:

-- is a comment indicator so using it in an SQL query means that the rest of the query will not be interpreted

Inferring the Database Type

Blind SQL injection vulnerabilities

Union Attack: retrieve data from other tables within the database

two key requirements must be met:
(1) individual queries must return the same number of columns
(2) data types in each column must be compatible between the individual queries

This generally involves figuring out:
– How many columns are being returned from the original query?
– Which columns returned from the original query are of a suitable data type to hold the results from the injected query?

On determining number of columns required in SQL injection UNION attack:

Using ORDER BY
ORDER BY command sorts the result set in ascending order
– use ORDER BY to increment specified column index until error occurs
– example: if injection point is a quoted string within the WHERE clause of original query, you would submit:
' ORDER BY 1--
' ORDER BY 2--
' ORDER BY 3--
etc.
– check error message: might return db error, might return generic error, infer how many columns

Using UNION SELECT
' UNION SELECT NULL--
' UNION SELECT NULL,NULL--
' UNION SELECT NULL,NULL,NULL--
– check error message