第一題:
玩游戲就OK了,好像我記得吾愛破解也有這樣的游戲。
第二題:
源碼內有個js文件
bp解碼
第三題
<?php $is_upload = false; define("UPLOAD_PATH", "./upload"); header("Content-type:text/html;charset=utf-8"); if(isset($_FILES)){ $ext_arr = array('jpg','png','gif'); $file_name = $_FILES['upload_file']['name']; $temp_file = $_FILES['upload_file']['tmp_name']; $file_ext = substr($file_name,strrpos($file_name,".")+1); $upload_file = UPLOAD_PATH . '/' . $file_name; if(move_uploaded_file($temp_file, $upload_file)){ if(in_array($file_ext,$ext_arr)){ $img_path = UPLOAD_PATH . '/'. rand(10, 99).@date("YmdHis").".".$file_ext; rename($upload_file, $img_path); $is_upload = true; }else{ $msg = "只允許上傳.jpg|.png|.gif類型文件!"; unlink($upload_file); } }else{ $msg = '上傳出錯!'; } } ?> <div id="upload_panel"> <ol> <li> <form enctype="multipart/form-data" method="post"> <input class="input_file" type="file" name="upload_file"/> <input class="button" type="submit" name="submit" value="上傳"/> </form> <div id="img"> <?php if(@$is_upload){ echo '<img src="'.$img_path.'" width="250px" />'; }else{ show_source(__FILE__); } ?> </div> </li> </ol> </div>
很明顯,競爭上傳。
第四題:
看樣子是,要讀取的文件用bin2hex(base64_encode(gzdeflate($file)))處理一下。
然后直接本地搭建了一個,生成!key!.php的加密值
發現
哦吼,讀取不出來。然后轉而讀取index.php
成功讀取。
<?php error_reporting(0); if (!function_exists('hex2bin')) { function hex2bin($hexdata){ $bindata = ''; for ($i=0; $i<strlen($hexdata); $i+=2){ $bindata .= chr(hexdec(substr($hexdata,$i,2))); } return $bindata; } } if(!function_exists('bin2hex')) { function bin2hex($str) { $strl = strlen($str); $fin = ''; for($i =0; $i < $strl; $i++) { $fin .= dechex(ord($str[$i])); } return $fin; } } @header('Hint: !key!.php && bin2hex(base64_encode(gzdeflate($file)))'); // if(!isset($_GET['jpg'])) // header('Refresh:0;url=./index.php?jpg=5338744a544e664c4b6b674841413d3d'); $file = gzinflate(base64_decode(hex2bin($_GET['jpg']))); echo '<title>web</title>'; echo '<center><h3>'.$_GET['jpg'].'</h3>'; $file = preg_replace("/[^a-zA-Z0-9.]+/","", $file); $file = str_replace("config","!", $file); $txt = base64_encode(file_get_contents($file)); echo '$file is :'.$file; echo "<br/>this is text:".$txt.'。'; echo "<img src='data:image/gif;base64,".$txt."'></img></center>"; ?>'
32行很顯然,將config替換為!,這....確實是故意的
$file = preg_replace("/[^a-zA-Z0-9.]+/","", $file);把感嘆號過濾了,然后又多了個config替換為感嘆號。
很顯然通過腳本生成加密文件
最終讀取!key!.php文件
內容
第五題:
注入題,吃完飯回來,哦吼~比賽結束了。
最初fuzz了一下,是過濾了空格、substring。/**/、substr就OK。
.....
又是一篇划水文。