第一题:
玩游戏就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。
.....
又是一篇划水文。