🏆Finding the SQL injection
-------------------------------------------------------------
How to to generate Errors
select * from table_name where id=23
select * from table_name where id='23'
select * from table_name where id="23"
select * from table_name where id=(23)
select * from table_name where id=('23')
select * from table_name where id=("23")Information Remember whenever the input is enclosed with single quotes only single quote with input will create error.
When input is enlcosed by double quotes a double qoute with input will give error.
When Input is not enlcosed with anything single quote and double quote both will give error.
-------------------------------------------------------------
Confirm test for Not enclosed Intiger input query
Perform these tests and check the reactions of the Application:
Input
Reaction if its Intiger Based Injection
-------------------------------------------------------------
Confirm test for Single quote enclosed Intiger input query
Perform these tests and check the reactions of the Application:
Input
Reaction if its Single Qoute Based Injection
-------------------------------------------------------------
Confirm test for Double quote enclosed Intiger input query
Perform these tests and check the reactions of the Application:
Input
Reaction if its Double Qoute Based Injection
-------------------------------------------------------------
Confirm test for Bracket quote enclosed Intiger input query
Perform these tests and check the reactions of the Application:
Input
Reaction if its Intiger Based Bracket enclosed Injection
-------------------------------------------------------------
Confirm test for Bracket enclosed Single Quote Intiger input query
Perform these tests and check the reactions of the Application:
Input
Reaction if its bracket enclosed Single Quote based Injection
-------------------------------------------------------------
Confirm test for Bracket enclosed Double Quote Intiger input query
Perform these tests and check the reactions of the Application:
Input
Reaction if its bracket enclosed Double Quote based Injection
-------------------------------------------------------------
Error may always not be real SQL error it may be some times generic error or change in output of the application.
All you have to do it recognise it.
MySQL Error Style:
MSSQL ASPX Error:
MSAccess (Apache PHP):
MSAccesss (IIS ASP):
Oracle Error:
ODBC Error:
PostgreSQL Error:
MS SQL Server: Error:
-------------------------------------------------------------
Different types of comments used in SQLi.
Comment
Name
While using # as comment type always remember to URL encode # to %23
-------------------------------------------------------------
How can we check for which comment to use
injection
If it gives same Output as 23 was giving then
So as i showed above test for '--' type comment in the same manner you can check for all commenting types and the one which gives same output as giving with Normal Output then that can help you understand the type of internal query alongwith the comment that you can use.
-------------------------------------------------------------
Understand the basics of injecting:
Any time anywhere or any application where ever and whenever you are injecting there are following three basic rules of injecting
[1]. Balance.
[2]. Inject.
[3]. Commenting.
Understanding the first phase "Balance":
In this phase we balance the internal query, for example after reading knowldge we understand that how can we assume and figure out the internal query used by the application where your input is injected. Lets say we figured out that out internal query is "Select * from tablename where id=('23')" so in this case our balance input should be 23').
The phase of Injection:
In this phase we inject as per our requirement, and the type of injection we are doing.
The phase of Commenting:
Then the last part of commenting, which we already know. Now check the below image which will show you all the three parts on injection.

-------------------------------------------------------------
'Order By' as we know if we give order by a number more than the number under the query, then it will throw an error. So we can easily understand that we can use order by to know how many columns we have inside the query
URL Injection
Internal Query
Output
-------------------------------------------------------------
-------------------------------------------------------------
Methodology
SQL Injection points:
-------------------------------------------------------------
Method 1:
-------------------------------------------------------------
Last updated