当前位置:网站首页>【XSS绕过-防护策略】理解防护策略,更好的绕过
【XSS绕过-防护策略】理解防护策略,更好的绕过
2022-07-03 04:33:00 【黑色地带(崛起)】
目录
一、简述
现在Web应用层有很多策略去处理XSS危害
eg:
特定标签过滤、事件过滤、敏感关键字过滤……
浏览器也会对XSS漏洞的利用进行限制(XSS Auditor、CSP等)
二、特定标签过滤
2.1、缺点:
过滤掉危险标签(如script、iframe等)就会导致无法执行脚本
2.2、现状:
任何一种标签,无论是否合法,都可以构造出XSS代码
<标签 οnclick="alert(/xss/)">快点我呀</标签>
2.3、利用:
属性值:输出点在HTML标签的属性中或在Javascript代码中,简单地闭合、拼接属性或Javascript代码就可以执行XSS代码
HTML:<video><source οnerrοr="alert(/xss/)">
三、事件过滤
3.1、简介:
一般会过滤掉许多HTML标签的事件属性,需要对所有可利用的事件属性进行遍历,测试是否存在遗漏(测试:Burp或编写脚本进行Fuzz)
3.2、常用的事件属性:
onafterprint、oninput、onscroll、onbeforeprint 、oninvalid 、onabort、onbeforeunload 、onreset 、oncanplay、onerror、 onselect 、oncanplaythrough、onhaschange、 onsubmit、 ondurationchange、onload 、onkeydown 、onemptied、onmessage 、onkeypress、 onended、onoffline、 onkeyup、 onerror、ononline 、onclick、 onloadeddata、onpagehide、 ondblclick、 onloadedmetadata、onpageshow 、ondrag、 onloadstart、onpopstate、 ondragend、 onpause、onredo、 ondragenter、 onplay、onresize 、ondragleave 、onplaying、onstorage 、ondragover 、onprogress、onundo、 ondragstart 、onratechange、onunload、 ondrop、 onreadystatechange、onblur 、onmousedown、 onseeked、onchange 、onmousemove 、onseeking、oncontextmenu 、onmouseout、 onstalled、onfocus、 onmouseover 、onsuspend、onformchange 、onmouseup 、ontimeupdate、onforminput、onmousewheel、 onvolumechange
3.3、非事件属性的标签
作用:可用于执行JavaScript代码
eg:JavaScript伪协议
<a href="javascript:alert(/xss/)">快点我呀</a>
四、敏感关键字(字符)过滤
(1)过滤“.”
(2)过滤“()”
(3)过滤空格
……
五、XSS Auditor
5.1、概述:
负责扫描网站的源代码,寻找类似跨站点脚本(XSS)攻击的模式,这种攻击可能试图在用户的浏览器中运行恶意代码 。通过检查输入的内容,判断该内容是否在输出中出现。如果符合XSS Auditor的过滤条件,则会直接阻止脚本执行。使反射型XSS漏洞的作用被逐步弱化。
六、内容安全策略(CSP)
6.1、概述:
内容安全策略(CSP)是目前最主要的Web安全保护机制之一,内容安全策略 (CSP) 是一个额外的安全层,用于检测并削弱某些特定类型的攻击,包括跨站脚本 (XSS) 和数据注入攻击等。
为了缓解潜在的跨站脚本问题,浏览器的扩展程序系统引入了内容安全策略(CSP),会使扩展程序在默认情况下更加安全,开发者可以创建并强制应用一些规则,管理网站允许加载的内容。开发人员可以使用这种工具以各种方式锁定其应用程序,降低内容注入漏洞(如跨站点脚本)的风险,并降低其应用程序执行的权限
内容安全策略以白名单的机制来管理网站要加载或执行的资源。在网页中,这样的策略是通过HTTP头信息或者meta标签来定义的。
虽然这个策略可以防止攻击者从外部网站跨域加载恶意代码,但是CSP并不能防止数据泄露。目前已经有很多安全研究人员提出了各种各样的技术来绕过内容安全策略,并利用该技术从目标网站中提取出所需数据。
七、推荐
【XSS跨站合集】反射型、存储型、DOM类XSS原理;输出在HTML、CSS、Javascript代码中
https://blog.csdn.net/qq_53079406/article/details/123694180?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165672818516782248534754%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165672818516782248534754&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-4-123694180-null-null.185^v2^control&utm_term=xss&spm=1018.2226.3001.4450【xss工具绕过】xss之burpsuite、前端、字典……
https://blog.csdn.net/qq_53079406/article/details/123901334?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165672818516782248534754%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165672818516782248534754&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~rank_v31_ecpm-1-123901334-null-null.185^v2^control&utm_term=xss&spm=1018.2226.3001.4450
边栏推荐
- 解决bp中文乱码
- Function introduction of member points mall system
- Which Bluetooth headset is cost-effective? Four Bluetooth headsets with high cost performance are recommended
- Classes in TS
- 多板块轮动策略编写技巧----策略编写学习教材
- Data Lake three swordsmen -- comparative analysis of delta, Hudi and iceberg
- 金仓数据库KingbaseES 插件kdb_database_link
- Web - Information Collection
- [Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
- Smart contract security audit company selection analysis and audit report resources download - domestic article
猜你喜欢
![[nlp] - brief introduction to the latest work of spark neural network](/img/65/35ae0137f4030bdb2b0ab9acd85e16.png)
[nlp] - brief introduction to the latest work of spark neural network

2022 t elevator repair simulation examination question bank and t elevator repair simulation examination question bank

Jincang KFS data bidirectional synchronization scenario deployment

Pyqt control part (II)

How to retrieve the password for opening word files

使用BENCHMARKSQL工具对KingbaseES执行测试时报错funcs sh file not found
![[dynamic programming] subsequence problem](/img/d8/020ae959ef53ce097d3a81a0d2d63a.jpg)
[dynamic programming] subsequence problem

Data Lake three swordsmen -- comparative analysis of delta, Hudi and iceberg

4 years of experience to interview test development, 10 minutes to end, ask too

BMZCTF simple_ pop
随机推荐
MySQL field userid comma separated save by userid query
因子选股-打分模型
使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver
Data Lake three swordsmen -- comparative analysis of delta, Hudi and iceberg
Learning practice: comprehensive application of cycle and branch structure (I)
GFS分布式文件系统(光是遇见已经很美好了)
2022 registration examination for safety production management personnel of hazardous chemical production units and examination skills for safety production management personnel of hazardous chemical
Triangular rasterization
有道云笔记
怎么用Kotlin去提高生产力:Kotlin Tips
220214c language learning diary
JVM原理简介
[set theory] inclusion exclusion principle (including examples of exclusion principle)
2.14 summary
2022 P cylinder filling test content and P cylinder filling simulation test questions
2022 Shandong Province safety officer C certificate examination content and Shandong Province safety officer C certificate examination questions and analysis
Basic types of data in TS
金仓数据库KingbaseES 插件kdb_exists_expand
RSRS指标择时及大小盘轮动
Kubernetes源码分析(一)