首页 -> 安全研究

安全研究

绿盟月刊
绿盟安全月刊->第39期->最新漏洞
期刊号: 类型: 关键词:
Oracle 9i应用服务器DAV_PUBLIC远程格式串溢出漏洞

日期:2003-03-03

发布日期:2003-02-19
更新日期:2003-02-21

受影响系统:
Oracle Oracle 9i Application Server 9.0.2
不受影响系统:
Oracle Oracle 9i Application Server 9.0.3
描述:
--------------------------------------------------------------------------------
BUGTRAQ  ID: 6846
CVE(CAN) ID: CAN-2002-0842

Oracle 9i应用服务器基于Apache Web服务器,支持SOAP、PL/SQL、XSQL、JSP等环境。

Oracle 9i应用服务器使用的DAV模块在记录错误信息时存在格式串错误,远程攻击者可以利用这个漏洞构建恶意请求破坏Oralce进程的堆栈结构,可能以'Oralce'进程权限在系统上执行任意指令。

最新的应用服务器版本9.0.2增加了对WebDAV的支持。DAV中的一个日志记录函数存在格式字符串漏洞,如果攻击者使用COPY方法和提供使用不同配置或不同端口的目的URI请求,就会返回'502 Bad Gateway'的应答,这个信息将被记录并且存在格式串问题。Apache中的DAV模块虽然也使用此有漏洞的代码,但是由于没有执行这个函数而不受此漏洞影响。Oralce修改了DAV模块并把错误的网关应答进行日志记录,就导致出现可利用的格式串攻击。

MODDAV部分源代码如下:

..
..
lookup = dav_lookup_uri(dest, r);
if (lookup.rnew == NULL)
{
      if (lookup.err.status == HTTP_BAD_REQUEST)
      {
            ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO,
r,lookup.err.desc);
            return HTTP_BAD_REQUEST;
      }
      return dav_error_response(r, lookup.err.status, lookup.err.desc);
}
..
..

这代码调用dav_util.c文件下的dav_lookup_uri()函数。

..
dav_lookup_result dav_lookup_uri(const char *uri, request_rec * r)
{
..
..
if (strcasecmp(comp.scheme, scheme) != 0 || comp.port != port)
{
      result.err.status = HTTP_BAD_GATEWAY;
      result.err.desc = ap_psprintf(r->pool,
      "Destination URI refers to different "
      "scheme or port (%s://hostname:%d)\n"
      "(want: %s://hostname:%d)",
      comp.scheme ? comp.scheme : scheme,
      comp.port ? comp.port : port,
      scheme, port);

      return result;

..
..
}

当dav_lookup_uri()返回给mod_dav.c的时候会发生格式字符串问题:

..
lookup = dav_lookup_uri(dest, r);
if (lookup.rnew == NULL)
{
      if (lookup.err.status == HTTP_BAD_REQUEST)
      {
      // THIS IS THE FIRST FORMAT STRING VULNERABILITY
      ap_log_rerror(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO,
r,lookup.err.desc);
..
..
}

攻击者通过构建恶意格式串发送给服务器,可导致覆盖堆栈中任意地址,可能以Oralce进程权限在系统上执行任意指令。成功利用此漏洞可以获得权限是在Linux/unix系统上为"Oracle"权限,而在Windows系统下Local System权限。

<*来源:NGSSoftware Insight Security Research (nisr@nextgenss.com)
  
  链接:http://www.nextgenss.com/advisories/ora-appservfmtst.txt
        http://otn.oracle.com/deploy/security/pdf/2003alert52.pdf
*>

测试方法:
--------------------------------------------------------------------------------

警 告

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

Oracle公告提供如下的测试方法:

1) http://host:port/dav_public



2) http://host:port/dav_portal

两个URI来利用这个格式字符串攻击。

建议:
--------------------------------------------------------------------------------
临时解决方法:

如果您不能立刻安装补丁或者升级,NSFOCUS建议您采取以下措施以降低威胁:

* 编辑ORACLE_HOME/Apache/oradav/conf目录下的moddav.conf文件:

更改如下行:

   DAV on
  


   DAV off
  
然后关闭文件,结果配置文件应该如下所示:

Load/Module ORACLE_HOME/Apache/oradav/lib/mod_oradav.so
#This is needed by mod_oradav to manage locks on WebDAV activity
#against a local file system and contains lock information about all
#WebDAV file resources.
DAVLockDB ORACLE_HOME/Apache/oradav/var/DAVLock
<Location/dav_public>
DAV off
#For extra security, enable the ForceType directive below.
#ForceType is used to prevent any scripts (jsp,php,…)
#from being run. Since this is a public location and anyone
#could upload a script and then execute it we need to be
#careful – we don’t want it exploited. To preserve
#mime types of files but to still protect against executables
#see HTTP Admin Documentation on mod_oradav regarding ORAGetSource.
#
#ForceType text/plain
</Location>

厂商补丁:

Oracle
------
Oracle已经为此发布了一个安全公告(OracleSA#52)以及相应补丁:
OracleSA#52:Two Vulnerabilities in Oracle9i Application Server
链接:http://otn.oracle.com/deploy/security/pdf/2003alert52.pdf

Oracle已经发布补丁号为2602262的补丁,用户可以在Oracle Worldwide Support Services web site下载补丁:

http://metalink.oracle.com

点击补丁按钮,进入补丁WEB页面,输入BUG号码2602262下载。
版权所有,未经许可,不得转载