当前位置:网站首页>【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
边栏推荐
- Two drawing interfaces - 1 Matlab style interface
- 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
- Crazy scientist
- Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended
- A outsourcing boy's mid-2022 summary
- FFMpeg example
- Dive Into Deep Learning——2.1数据操作&&练习
- Leetcode simple question: check whether two string arrays are equal
- SSM based campus part-time platform for College Students
- Summary of training competition (Lao Li's collection of questions)
猜你喜欢

跨境电商多商户系统怎么选

Introduction of pointer variables in function parameters

FFMpeg filter

X-ray normal based contour rendering

Use the benchmarksql tool to perform a data prompt on kingbases. The jdbc driver cannot be found

使用BENCHMARKSQL工具对KingbaseES执行测试时报错funcs sh file not found

Asp access teaching management system design finished product

Fcpx template: sweet memory electronic photo album photo display animation beautiful memory

有道云笔记

Auman Galaxy new year of the tiger appreciation meeting was held in Beijing - won the double certification of "intelligent safety" and "efficient performance" of China Automotive Research Institute
随机推荐
Leetcode simple question: check whether two string arrays are equal
C primre plus Chapter 10 question 6 inverted array
Kingbasees plug-in KDB of Jincang database_ exists_ expand
Web security - CSRF (token)
使用BENCHMARKSQL工具对kingbaseES执行灌数据提示无法找到JDBC driver
540. Single element in ordered array
2022 t elevator repair simulation examination question bank and t elevator repair simulation examination question bank
Why should programmers learn microservice architecture if they want to enter a large factory?
Feature_selection
4 years of experience to interview test development, 10 minutes to end, ask too
Library management system based on SSM
AWS VPC
vulnhub HA: Natraj
多板块轮动策略编写技巧----策略编写学习教材
FuncS sh file not found when using the benchmarksql tool to test kingbases
使用BENCHMARKSQL工具对kingbasees并发测试时kill掉主进程成功后存在子线程未及时关闭
Design and implementation of JSP logistics center storage information management system
[Thesis Writing] how to write the overall design of JSP tourism network
Which Bluetooth headset is good about 400? Four Bluetooth headsets with strong noise reduction are recommended
Data Lake three swordsmen -- comparative analysis of delta, Hudi and iceberg