google firing-range xss测试应用
firing-range是谷歌发布的一个XSS测试环境,用来检测扫描器的能力。在线访问地址:https://public-firing-range.appspot.com
谷歌对每个位置都进行了详细的分类。
对其中两例进行分析:location.hash.assign
<script>
var payload = window.location.hash.substr(1);window.location.assign(payload);
</script>
获取hash值,进入了assign函数。
参考搜狗浏览器4.2.2.9903任意网站伪造+自有协议下XSS*2
location.hash.innerHtml
<script>
var payload = window.location.hash.substr(1);var div = document.createElement('div');
div.id = 'divEl';
document.documentElement.appendChild(div);
var divEl = document.getElementById('divEl');
divEl.innerHTML = payload;
</script>
location.search 和location.hash
测试发现location.search获取到的值是浏览器地址栏url编码后的。而location.hash获取到的值是原始的值,既hash是%23获取到就是%23,hash是<
获取到就是<
说以直接innerHtml可以触发xss。