โš ๏ธMSSQL Error Based Injection

when and why to use error based SQLi: its when you are not able to get any output using Union based injection and the error is visible to you. In such case you have to use Error based Injection.

-------------------------------------------------------------

Step : 1

Putting single quote and then putting double quote checking the Error:


http://www.timescanindia.in/Product.aspx?Id=7'
ERROR

http://www.timescanindia.in/Product.aspx?Id=7"
ERROR

when both single quote and double quotes give error then apply the golden rule that the injection is integer type:

----------------------------------------------------------------

Step : 2

Now we need to know the comment type for MSSQL.

Comment
Name

--

Comment Type 1

--+

Comment Type 2

--+-

SQL Comment

/**/

Inline Comment

;%00

Null Byte

Now lets try the basic -- comment with our target:

----------------------------------------------------------------

Step : 3

Now lets inject error based injection and get out output using error:

----------------------------------------------------------------

Step : 4

Now so lets continue with it and get the version:

Now lets play our finishing move, we'll use our ninjutsu and finish it up:

Step : 5

We have used MSSQL DIOS:

Now to view the table we have created, use this query:

Well that will do the trick for us, but other than the above there are some other ways we can do an error based injection. Like getting all the tables and columns in just one query as given below:

So Here we are finished with MSSQL Error Based Injection.

Last updated