serVuln4 create_fucntion与可变函数
源码<?phpclass Cancer{ public $key; public function __destruct() { printf("%s\n", __METHOD__); unserialize($this->key)(); }}class GetFlag{ public $code; public $func = "create_function"; public function create() { printf("%s\n", __METHOD__); $a = $this->func; $a('', $this->code); }}if (isset($_REQUEST['Cancer'])) { unserialize($ ...
serVuln3 代码审计2
源码<?phpclass Gemini{ var $id; var $user; public function __construct($id, $user) { $this->id = $id; $this->user = $user; } function __destruct() { printf("%s\n", __METHOD__); $this->login(); } function login() { printf("%s\n", __METHOD__); if ($this->id === "1317" and $this->user === "lutalica") { echo file_get_contents( ...
serVuln2 代码审计
源码<?phpclass Taurus{ var $user; var $pass; var $email; public function __construct($user, $pass, $email) { $this->user = $user; $this->pass = $pass; $this->email = $email; } function __destruct() { printf("%s\n", __METHOD__); $this->register(); } function register() { printf("%s\n", __METHOD__); if ($this->user === "lutalica" && $ ...
serVuln1 类的实例化
背景反序列化是将序列化的数据转换回其原始形式的过程。序列化是将数据结构或对象状态转换为可以存储或传输的格式的过程,这样在需要的时候可以通过反序列化恢复到原始状态。
反序列化常常用于例如通过网络接收对象状态等等场景。
如果修改序列化的数据,以改变反序列化后的对象状态。这可能导致任意代码执行等安全问题。
例如,在PHP中,如果使用**unserialize()**函数处理用户提供的数据,可能会导致反序列化漏洞。当提供一个包含恶意对象的序列化字符串,这个字符串被反序列化时,恶意对象的__wakeup()或__destruct()方法可能会被触发,从而执行攻击者的代码。
源码<?phpclass Aries{ var $command; function execute() { printf("%s\n", __METHOD__); eval($this->command); } function __wakeup() { printf(&quo ...