web1
拿到题目
提示我们访问robots.txt
得到结果
于是去访问source.php
按一系列要求改http头
发现得到主页内容,说明的确是用来存放url请求内容的
那么想到file协议
具体原理看
于是得到flag
然后顺手带走题目源代码
";if(isset($_POST['admin'])){if($_POST['admin']==1){if($_SERVER['HTTP_X_CLIENT_IP']){if(isset($_POST['url'])&&parse_url($_POST['url'])['host']=='www.ichunqiu.com'){$curl=curl_init();curl_setopt($curl,CURLOPT_URL,$_POST['url']);curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);$content=curl_exec($curl);curl_close($curl);$filename='download/'.rand().';img1.jpg';file_put_contents($filename,$content);echo$_POST['url'];$img="";echo$img;}else{echo"you need post url: http://www.ichunqiu.com";}}else{echo"only 127.0.0.1 can get the flag!!";}}}else{$_POST['admin']=;}?>
发现果然是and解析顺序的问题
web2
扫描目录得到源码泄露
恢复源码得到
method=$method;$this->args=$args;}function__wakeup(){andtocontinueforeach($this->argsas$k=>$v){$this->args[$k]=$this->waf(trim($v));}}functionwaf($str){$str=preg_replace("/[*;|?\n ]/","",$str);$str=str_replace('flag','',$str);return$str;}functionecho($host){system("echo $host");}function__destruct(){if(in_array($this->method,array("echo"))){call_user_func_array(array($this,$this->method),$this->args);}}}$first='hi';$var='var';$bbb='bbb';$ccc='ccc';$i=1;foreach($_GETas$key=>$value){if($i===1){$i++;$$key=$value;}else{break;}}if($first==="doller"){@parse_str($_GET['a']);if($var==="give"){if($bbb==="me"){if($ccc==="flag"){echo"
welcome!
";$come=@$_POST['come'];unserialize($come);}}else{echo"
think about it
";}}else{echo"NO";}}else{echo"Can you hack me?
";}?>
发现关键waf
function waf($str){ $str=preg_replace("/[*;|?\n ]/","",$str); $str=str_replace('flag','',$str); return $str; }
思考到可以使用双写绕过flag,用绕过空格
所以有
那么可以容易得到
web3
题目给了代码
实际上就是pwnhub公开赛的题魔改的,后面拼上了橘子哥的one line php
首先是前面的上传校验
if($_FILES['file']['name']){ $filename = !empty($_POST['file']) ? $_POST['file'] : $_FILES['file']['name']; if (!is_array($filename)) { $filename = explode('.', $filename); } $ext = end($filename); if($ext==$filename[count($filename) - 1]){ die("emmmm..."); }
漏洞很明显,只判断了不是数组的时候,没判断是数组的时候,于是有了数组绕过
然后到后面的
$new_name = (string)rand(100,999).".".$ext; move_uploaded_file($_FILES['file']['tmp_name'],$new_name); $_ = $_POST['hehe']; if(@substr(file($_)[0],0,6)==='@
unlink的问题非常明显,的后缀就可以绕过
于是有了以下方式
发现成功上传(本地测试了一下)
然后进行目录爆破,反正就100~999,即可包含成功文件名,从而获得flag
web4
拿到题目后看到2个功能
于是先从select guest入手,进行注入
回显
然后
回显
于是开始写探测过滤,发现
均被过滤,那么尝试用bool盲注
而对于另外两个关键词,可以使用
进行bypass
随机注入得到管理员密码
登入后发现是一个上传页面:
如果上传.php会提示
如果上传别的,会提示
题目会帮你拼接一个.txt后缀
并且提示你要上传flag.php,
首先发现有2个变量可控
那么容易想到保存方式为
那么我们把php后缀拆开
接下来就是如何截断了
首先尝试00未果,随机爆破,在02时发现截断成功
转自先知社区
欢迎收藏并分享朋友圈,让五邑人网络更安全
欢迎扫描关注我们,及时了解最新安全动态、学习最潮流的安全姿势!
领取专属 10元无门槛券
私享最新 技术干货