一些思路和想法

在此记录一些想法

hook innerHTML (2017-02-23)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
(function () {
var setter = Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML').set;
Object.defineProperty(Element.prototype, 'innerHTML', {
set: function innerHTML_Setter(val) {
console.group();
console.log('innerHTML on Object:', this);
console.log('Value:', JSON.stringify(val));
var stack = new Error().stack;
// Remove this function from the stack:
stack = stack.trim().split('\n').slice(1).join(' <- ')
console.log('Stack: ', stack)
console.groupEnd();
// call original innerHTML setter:
return setter.call(this, val);
}
});
})();

参考资料

https://gist.github.com/mozfreddyb/a096627cc6b2e565a4c2

关闭chrome的安全措施方便检测xss (2017-02-23)

alias unsafe='open -a Google\ Chrome\ Canary --args --disable-web-security --user-data-dir=$HOME/chrome_profile'

302 响应跳转后的页面获取的referer不是发生跳转的url,而是发生跳转页面的referer (2017-02-22)

这样微信oauth认证及时能控制回调地址也不能通过referer拿到code,只能看网站本身实现上会不会有信息泄露。

307/308 响应不改变请求method以及body (2017-02-14)

可以用307或者308来获取post中的内容。与注入<base>标签配合。

前端只有一个页面降域只能拿cookie不影响其他页面 (2017-02-14)

有 b.a.com 和 c.a.com 两个站,b.a.com 只有一个页面降域为a.com。在c.a.com执行javascript只能通过这一个降域的页面拿到b.a.com的cookie以及该页面的内容,不能拿到更多。原因是,用脚本降域之前,cookie值已经保存在document.cookie里。降域后,该页面的域已经和其他页面不同,故无法影响到其他页面。此时无法通过 c.a.com 把 b.a.com 中降域的页面恢复成 b.a.com 域。

MySQL 5.7 默认开启 Strict SQL Mode

同时 MySQL 5.7.5 还开启了STRICT_TRANS_TABLES。因此MySQL无法弱类型转换了。

self+login/logout CSRF = PWN! (2017-02-09)

在33c3 CTF里跟火日大佬学到的,先用一个iframe载入想要读取内容的页面,再用另一个iframe登陆自己的账号触发xss并读取到第一个iframe的内容。

参考资料

http://www.geekboy.ninja/blog/airbnb-bug-bounty-turning-self-xss-into-good-xss-2/

jQuery Mobile XSS (需要上传任意内容文件文件或者open redirect) (2017-02-09)

jq.html

1
2
3
<link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

xss.jpg

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

http://127.0.0.1/jq.html#/xss.jpg

xss.jpg 不能用script标签,但是可以用on事件。

参考资料

http://sirdarckcat.blogspot.com/2017/02/unpatched-0day-jquery-mobile-xss.html

在Chrome内置函数执行时,先取长度后解析参数可能导致越界读 (2017-02-08)

在CVE-2016-4622中,Array.prototype.slice的native代码先取了数组的长度,后解析函数的参数。在取参数的时候,参数类型转换/用proxy/Array.prototype.__defineGetter__都可以将真正的数组修改掉,导致了两者不一致,发生越界读的问题。可以在源码级别找到这种模式批量扫。

参考资料

http://drops.wiki/index.php/2016/12/10/jscpwn/
http://paper.seebug.org/207/

js用ROP的思路混淆,保护页面版权 (2017-02-08)

用html页面的内容动态生成js来做核心脚本的混淆,这样一旦被别人抄袭修了了html中的内容,那么js就会执行失败

参考资料

http://div.io/topic/1220
https://www.zhihu.com/question/47047191

分享到 评论