一、题目/源代码

链接:https://buuoj.cn/challenges

<?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']);
        }
    }
}

二、题目分析

这道题是一个 PHP 反序列化 + 弱类型比较 的漏洞利用题,目标是让 BUU 类的 __destruct() 方法执行时满足 $this->correct === $this->input,从而读取 /flag

在很努力的成为一个真正的大佬!