当前位置:网站首页>xss漏洞的一些思考
xss漏洞的一些思考
2022-07-20 01:13:00 【Beyond My】
xss漏洞的一些思考
话不多说,直接看这两个实战案例:
xss之案例一:
1、某系统存在问题反馈功能,如下图:
2、这里当然可以测试文件上传,但今天的主题是XSS,故直接略过,首先随意输入,然后点击查看,便可以看到提交的问题:
3、开启Burp,抓包测试:
分析数据包:此时主要可控参数有3个,description代表反馈内容;contact代表电话;url代表上传图片的位置。
4、经测试,description和contact均已被实体化输出。所以只能转移到url参数上,查看源代码分析:
5、很明显看到它直接将url里的数据放到了<img src="">
里面,所以我们将最终数据拼接为这样测试:<img src="1" onerror="alert(1)">
payload:
1" οnerrοr="alert(666)
6、就当我激动的点击查看幻想弹窗时,意外发生了,它并没有弹,源码中也没有任何信息:
7、于是我又返回定位了查看的源码:
8、在这里看到了如下a标签:
<a href="javascript:void(0)" data-url="url=1" onerror="alert(666)" data-replycontent="null" data-description="test" data-moduleame="我的反馈" data-submittime="2022-07-14 19:30:41" data-replytime="null" class="feedback-detail">查看</a>
9、既然跳转后不行,那我们就直接在a标签里面闭合来构造XSS语句:
关键拼接处:
之前payload后是这样的:
data-url="url=1" onerror="alert(666)"
还原后应该是这样的:
data-url=""
重新构造后理想状态是这样的:
data-url=""><img src="1" onerror="alert(1)"></a>
payload:
"><img src="1" οnerrοr="alert(1)"></a>
提交查看,成功弹窗,存储型XSS一枚
10、重新定位查看源代码:
xss之案例二:
1、某系统存在自评内容,这里直接输出payload测试:
2、返回查看结果,可以看到后面的</script>
被删除了:
3、怀疑是限制了显示的大小,经过查看html最多取25个:
4、那么我们用img来测试:
payload:
<img src="1" onerror="alert(1)">
5、可以看到img标签成功执行,但是这里的等号被编码为了=
思考:这里代码可能首先会通过正则等方式去匹配=,若匹配到,则替换为=
类似如下:
<?php
$str = '=';
$str2 = '<img src="1" οnerrοr="alert(1)">';
//$str2 = '<img src="1" onerror = "alert(1)">';
$res = str_replace($str,"=",$str2);
echo($res);
?>
6、通过尝试,将=变为[空格]=[空格]则可以干扰原有的规则,让其匹配不到=,从而绕过:
payload:
<img src="1" onerror = "alert(1)">
查看源代码如下:
7、思考:
尝试使用以上方法在代码中实现,测试了正则,字符串替换等方式,均未成功,=都会被替换!希望有大佬指点指点!
边栏推荐
- CCTV news "Beijing opens accommodation quota invoice by hand" news channel_ People's network
- STM32 porting lvgl8.2
- CCTV news news news channel "Tianjin opens catering quota invoice by hand"_ People's network
- 【JVM 系列】JVM 对象的分配策略
- 要想成功进行数字化转型 首席信息官应遵循的三个原则
- CCTV news "Shanghai rent quota invoice by hand" news channel_ People's network
- 想低成本保障軟件安全?五大安全任務值得考慮
- WPF implements drawer menu
- Some rules for implicit conversion of SAP ABAP character and string variables
- [leetcode] split the basic template and find the left and right boundaries
猜你喜欢
弃用 Notepad++,这款开源替代品更牛逼!
What is the win11 staging folder? Where is the win11 online upgrade staging folder
想低成本保障软件安全?五大安全任务值得考虑
【翻译】C#表达式中的动态查询
Abandon notepad++, this open source alternative is more awesome!
这款国产良心软件正式开源!
What is the difference between zero trust and SASE? The answer is not really important
Protocol buffer learning
零信任和SASE有什么不一样?答案其实并不重要
C# 看懂这100+行代码,你就真正入门了(经典)
随机推荐
【JVM 系列】JVM 中常见的垃圾回收器
[JVM series] common garbage collector in JVM
CCTV news news "Beijing opens catering manual tearing quota invoice" news channel_ People's network
How to check whether win11 can be upgraded to 22h2? How to upgrade 22h2 in win11
Hollysys PLC master-slave station communication
Popular understanding of tensor
Implement metersphere signature signature through shell
Weex demining 1:data this
CCTV news "Chengdu rent quota invoice by hand" news channel_ People's network
What are the differences and connections between cloud computing and edge computing?
Detailed explanation of JDBC function classes
云计算与边缘计算有什么区别和联系?
What is the reason why the easycvr video Plaza device list cannot be scrolled and loaded?
Warning FailedScheduling 8s default-scheduler 0/3 nodes are available: 1 Insufficient memory
Win11如何开启任务栏多样化?Win11开启新任务栏的方法
和利时LE5107_LE5106_自由口协议
液晶ST7302图像缓存结构
WPF implements drawer menu
Changjiang Dayong, director of opengauss community: opengauss cooperates with industry innovation to build an open source database root community
英伟达NX使用笔记