291 字
1 分钟
CVE-2016-7124
正如简介里面所写的这个漏洞是一个反序列化的魔术方法的漏洞。
CVE-2016-7124
当序列化字符串中表示对象属性个数的值大于 真实的属性个数时会跳过__wakeup的执行。
这个漏洞利用点就是在反序列化过程中不执行__wake方法。
上例子:
<?php class secret{ public $file='index.php'; public function __construct($file){ $this->file = $file; }
public function __destruct(){ include($this->file); if($flag != null){ echo "<br>flag: ".$flag; }else{ echo "sorry, flag not found"; } }
public function __wakeup(){ $this->file='fakeflag.php'; } } $cmd=$_GET['cmd'];
if (!isset($cmd)) echo show_source(__FILE__); else { if (preg_match('/[oc]:\d+:/i',$cmd)){ echo "Are you daydreaming?"; } else{ unserialize($cmd); } } //secret in flag.php?> 1 public function __wakeup(){ $this->file='fakeflag.php'; }看这里,这边直接写好了,当执行 unserialize($cmd); 这一句的时,如果正常走魔术函数的调用,那么file对象会被直接写成 fakeflag.php。
导致我们不论写什么都没用。
echo "<br>flag: ".$flag;到这里就读取不到flag的值了。
所以我们必须先绕过__wake方法,也就是利用到了这个漏洞。
而还有一个点,就是有一个拦截匹配。
这边就不具体展开讲了。
- 版权声明:本文由 余林阳 创作,转载请注明出处。
喜欢这篇文章吗?
点击右侧按钮为文章点赞,让更多人看到!
CVE-2016-7124
https://sliver-yu.cc/posts/漏洞搜集/cve-2016-7124/
在下余林阳