攻防世界 WEB WEB_PHP_UNSERIALIZE

首先需要讲明的一件事是,PHP序列化的时候对public protected private变量的处理方式是不同的
具体看这篇文章,https://blog.csdn.net/Xxy605/article/details/117336343,注意,这里的\00表示是不可见字符,并不是单纯的\00,相当于url里面的%00所以需要自己写代码
让编译器帮我们做序列化
这题源码没什么难度

file = $file; 
    }
    function __destruct() { 
        echo @highlight_file($this->file, true); 
    }
    function __wakeup() { 
        if ($this->file != 'index.php') { 
            //the secret is in the fl4g.php
            $this->file = 'index.php'; 
        } 
    } 
}
if (isset($_GET['var'])) { 
    $var = base64_decode($_GET['var']); 
    if (preg_match('/[oc]:\d+:/i', $var)) { 
        die('stop hacking!'); 
    } else {
        @unserialize($var); 
    } 
} else { 
    highlight_file("index.php"); 
} 
?>

两个点:1.正则对形如o:4:…这种做了过滤,可以用+4进行绕过
2.wakeup方法绕过,属性值大于实际值即可绕过
然后可以写代码

 
class Demo 

你可能感兴趣的:(攻防世界,web安全)