前言
在2020-11-23
号,在twitter
上看到有师傅发了,Zend Framework
框架的一条反序列化链。之后也剖析了下,找到了几条链子,之后跟了跟其他版本的,都是存在反序列化破绽的。然后就出了两个问题,一个 最新版的 laminas 和一个ZendFramework 1 的链子。来写下文章抛砖引玉吧,应该照样有许多的链子的。
1. ZEND 1反序列化链剖析
1.1 获取源码&建立zf1项目
原pop链地址
实在一开始照这个框架就找了我一阵,由于zend framework
已经到了zf4
(laminas)了,而这个反序列化链子是zf1
,以是我们需要先从https://github.com/zendframework/zf1
中下载到源码,然后使用
然后进入bin
目录使用如下下令,来建立一个项目目录web1
。接着我们把libary
中的Zend
目录移动到项目目录web1/libary
中
zf create project web1
这样我们就得到了一个zf1
框架。接着我们修改一下application\controllers\IndexController.php
<?php class IndexController extends Zend_Controller_Action { public function init() { /* Initialize action controller here */ } public function indexAction() { // action body unserialize(base64_decode($_POST['Mrkaixin'])); return "Mrkaixin"; } }
1.2 图说POP链
先抛出整个行使栈吧。
Callback.php:150, Zend_Filter_Callback->filter()
Inflector.php:473, Zend_Filter_Inflector->filter()
Layout.php:780, Zend_Layout->render()
Mail.php:371, Zend_Log_Writer_Mail->shutdown()
Log.php:366, Zend_Log->__destruct()
IndexController.php:14, IndexController->indexAction()
...
Application.php:384, Zend_Application->run()
index.php:26, {main}()
整个pop链切入点在library\Zend\Log.php
中的__destruct
,欢迎进入欧博开户网址(Allbet Gaming):www.aLLbetgame.us,欧博网址开放会员注册、代理开户、电脑客户端下载、苹果安卓下载等业务。
这里遍历了$this->_writers
,而且触发了其中工具的shutdown()
方式。这里我们使用的是Zend_Log_Writer_Mail
这个类的shutdown()
接着跟进这个filter
这里实在可以看到这个链子的亮点就是,两个filter
函数的挪用。以及最后的create_function
的下令注入。给人的感受就是这个链子异常连贯。赞
1.3. 挖掘潜藏的反序列化链
这里实在另有许多的链子,这里丢一条挺简朴的链子。
1.3.1 写Shell
先放上挪用栈
File.php:464, Zend_CodeGenerator_Php_File->write()
Yaml.php:104, Zend_Config_Writer_Yaml->render()
Mail.php:371, Zend_Log_Writer_Mail->shutdown()
Log.php:366, Zend_Log->__destruct()
IndexController.php:14, IndexController->indexAction()
...
Application.php:384, Zend_Application->run()
index.php:26, {main}()
我们使用public function render\(\)
这个正则来搜索一下,有没有可以行使的render()
函数。
最后锁定了library\Zend\Config\Writer\Yaml.php
public function render() { // 这里可以自己跟一下,很简朴就可以绕过的。 // $data 可以是随便的。 $data = $this->_config->toArray(); $sectionName = $this->_config->getSectionName(); $extends = $this->_config->getExtends(); if (is_string($sectionName)) { $data = array($sectionName => $data); } foreach ($extends as $section => $parentSection) { $data[$section][Zend_Config_Yaml::EXTENDS_NAME] = $parentSection; } // Ensure that each "extends" section actually exists foreach ($data as $section => $sectionData) { if (is_array($sectionData) && isset($sectionData[Zend_Config_Yaml::EXTENDS_NAME])) { $sectionExtends = $sectionData[Zend_Config_Yaml::EXTENDS_NAME]; if (!isset($data[$sectionExtends])) { // Remove "extends" declaration if section does not exist登录并阅读全文
转载声明:本站发布文章及版权归原作者所有,转载本站文章请注明文章来源!
网友评论
2条评论UG环球
回复本场最佳:36岁詹姆斯再演不老神话可以,在看
环球ug平台卖分(www.ugbet.us)
回复贼棒,看得揪心啊