不要小看注釋掉的JS 引起的安全問題
更新時間:2008年12月27日 16:46:16 作者:
HTTP Response Splitting 攻擊主要說明的是兩個問題
一個是header插入問題。
另一個是\r\n問題。
我們來看這樣一段代碼:
1. test
2. <script>
3. //alert('<%=request.getParameter("username")%>');
4. </script>
大家都能看到,這好像有個漏洞,但是已經(jīng)被補上了,注釋掉了。
那既然注釋掉了,就不該有問題了么?
不是的。
再看這個URL
http://localhost/index.jsp?username=kxlzx%0d%0a%0d%0aalert('kxlzx
很無奈吧?
生成了如下代碼:
test
<script>
//alert('kxlzx
alert('kxlzx ');
</script>
注釋掉的JS,也執(zhí)行了。
所以,不要把沒用的代碼,注釋掉的JS等,扔到html里。
代碼審核是個細活,任何疏漏之處都值得注意。
另一個是\r\n問題。
我們來看這樣一段代碼:
1. test
2. <script>
3. //alert('<%=request.getParameter("username")%>');
4. </script>
大家都能看到,這好像有個漏洞,但是已經(jīng)被補上了,注釋掉了。
那既然注釋掉了,就不該有問題了么?
不是的。
再看這個URL
http://localhost/index.jsp?username=kxlzx%0d%0a%0d%0aalert('kxlzx
很無奈吧?
生成了如下代碼:
test
<script>
//alert('kxlzx
alert('kxlzx ');
</script>
注釋掉的JS,也執(zhí)行了。
所以,不要把沒用的代碼,注釋掉的JS等,扔到html里。
代碼審核是個細活,任何疏漏之處都值得注意。
相關(guān)文章
JS 在指定數(shù)組中隨機取出N個不重復(fù)的數(shù)據(jù)
這篇文章主要介紹了JS 在指定數(shù)組中隨機取出N個不重復(fù)數(shù)據(jù)的方法,需要的朋友可以參考下2014-06-06淺析使用BootStrap TreeView插件實現(xiàn)靈活配置快遞模板
這篇文章主要介紹了使用bootstrap-treeview插件實現(xiàn)靈活配置快遞模板的相關(guān)資料,非常不錯,具有一定的參考借鑒價值,需要的朋友可以參考下2016-11-11