当前位置:网站首页>【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
边栏推荐
- Factor stock selection scoring model
- Redis persistence principle
- Mongodb slow query optimization analysis strategy
- Golang -- realize file transfer
- Library management system based on SSM
- Two drawing interfaces - 1 Matlab style interface
- Summary of training competition (Lao Li's collection of questions)
- Contents of welder (primary) examination and welder (primary) examination in 2022
- 2022 Shandong Province safety officer C certificate examination content and Shandong Province safety officer C certificate examination questions and analysis
- [Chongqing Guangdong education] reference materials for design and a better life of Zhongyuan Institute of science and technology
猜你喜欢
Know that Chuangyu cloud monitoring - scanv Max update: Ecology OA unauthorized server request forgery and other two vulnerabilities can be detected
Feature_selection
stm32逆向入门
Truncated sentences of leetcode simple questions
Employee attendance management system based on SSM
Web - Information Collection
How to retrieve the password for opening word files
2022 new examination questions for the main principals of hazardous chemical business units and examination skills for the main principals of hazardous chemical business units
2022 registration of G2 utility boiler stoker examination and G2 utility boiler stoker reexamination examination
使用BENCHMARKSQL工具对KingbaseES执行测试时报错funcs sh file not found
随机推荐
MC Layer Target
2022 P cylinder filling test content and P cylinder filling simulation test questions
Mount NFS in kubesphere
怎么用Kotlin去提高生产力:Kotlin Tips
[文献阅读] Sparsity in Deep Learning: Pruning and growth for efficient inference and training in NN
Triangular rasterization
Joint search set: the number of points in connected blocks (the number of points in a set)
2022 Shandong Province safety officer C certificate examination content and Shandong Province safety officer C certificate examination questions and analysis
When using the benchmarksql tool to test the concurrency of kingbasees, there are sub threads that are not closed in time after the main process is killed successfully
[set theory] set identities (idempotent law | exchange law | combination law | distribution rate | De Morgan law | absorption rate | zero law | identity | exclusion law | contradiction law | complemen
540. Single element in ordered array
[free completion] development of course guidance platform (source code +lunwen)
X-ray normal based contour rendering
Crazy scientist
使用BENCHMARKSQL工具对KingbaseES预热数据时执行:select sys_prewarm(‘NDX_OORDER_2 ‘)报错
[fairseq] 报错:TypeError: _broadcast_coalesced(): incompatible function arguments
Human resource management system based on JSP
[set theory] ordered pair (ordered pair | ordered triple | ordered n ancestor)
FuncS sh file not found when using the benchmarksql tool to test kingbases
IPhone x forgot the boot password