<?php
/**
* Created by PhpStorm.
* User: jinzhao
* Date: 2019/10/6
* Time: 8:04 PM
*/
highlight_file(__FILE__);
class BUU {
public $correct = "";
public $input = "";
public function __destruct() {
try {
$this->correct = base64_encode(uniqid());
if($this->correct === $this->input) {
echo file_get_contents("/flag");
}
} catch (Exception $e) {
}
}
}
if($_GET['pleaseget'] === '1') {
if($_POST['pleasepost'] === '2') {
if(md5($_POST['md51']) == md5($_POST['md52']) && $_POST['md51'] != $_POST['md52']) {
unserialize($_POST['obj']);
}
}
}
代码审计
查看执行的过程
发现我们需要用get方法传递pleaseget变量值为1,用post方法传递pleasepost变量值为1,然后用post方法传递md51和md52的内容不同
但是md5值相同
参考我的另一篇blog:https://blog.csdn.net/weixin_45844670/article/details/108286503
然后用post方法传obj变量,利用反序列化漏洞
这里要进行一个判断,就是buu类中的correct和input内容强相等,这里利用传引用的方法
$a= new BUU(); $a->correct=&$a->input; echo serialize($a);
更改这里序列化出来的内容
参考我的blog:https://blog.csdn.net/weixin_45844670/article/details/108171963
传递后即可得到flag