安全研究

安全漏洞
Firebird SQL fbserver connect请求远程缓冲区溢出漏洞

发布日期:2007-06-12
更新日期:2007-06-15

受影响系统:
Firebird Firebird SQL 2.0
不受影响系统:
Firebird Firebird SQL 2.0.1
描述:
BUGTRAQ  ID: 24436
CVE(CAN) ID: CVE-2007-3181

Firebird SQL是一个全功能的轻量级免维护数据库。

Firebird SQL数据库默认监听于TCP 3050端口的数据库服务fbserver.exe中存在缓冲区溢出漏洞,远程攻击者可能利用此漏洞控制服务器。

该服务在处理connect请求(0x1)时以如下方式拆分:

typedef struct p_cnct
{
    P_OP p_cnct_operation;          /* OP_CREATE or OP_OPEN */
    USHORT p_cnct_cversion;         /* Version of connect protocol */
    P_ARCH p_cnct_client;           /* Architecture of client */
    CSTRING p_cnct_file;            /* File name */
    USHORT p_cnct_count;            /* Protocol versions understood */
    CSTRING p_cnct_user_id;         /* User identification stuff */
    struct p_cnct_repeat
    {
        USHORT p_cnct_version;      /* Protocol version number */
        P_ARCH p_cnct_architecture; /* Architecture of client */
        USHORT p_cnct_min_type;     /* Minimum type */
        USHORT p_cnct_max_type;     /* Maximum type */
        USHORT p_cnct_weight;       /* Preference weight */
    }
    p_cnct_versions[10];
} P_CNCT;

如果为p_cnct_count指定了超大值的话,就会在报文的XDR处理中出现未经检查的循环,导致覆盖本地rem_port结构及其vtable。具体来说,在XDR处理的下一次迭代中会调用rem_port->receive函数指针。有漏洞的代码如下:

protocol.cpp:318
for (i = 0, tail = connect->p_cnct_versions; i < connect->p_cnct_count; i++, tail++)
{
    MAP(xdr_short, reinterpret_cast(tail->p_cnct_version));
    MAP(xdr_enum, reinterpret_cast(tail->p_cnct_architecture));
    MAP(xdr_u_short, tail->p_cnct_min_type);
    MAP(xdr_u_short, tail->p_cnct_max_type);
    MAP(xdr_short, reinterpret_cast(tail->p_cnct_weight));
}

在循环操作中应检查tail的大小。

<*来源:Cody Pierce
  
  链接:http://secunia.com/advisories/25601/
        http://dvlabs.tippingpoint.com/advisory/TPTI-07-11
        http://security.gentoo.org/glsa/glsa-200707-01.xml
*>

建议:
厂商补丁:

Gentoo
------
Gentoo已经为此发布了一个安全公告(GLSA-200707-01)以及相应补丁:
GLSA-200707-01:Firebird: Buffer overflow
链接:http://security.gentoo.org/glsa/glsa-200707-01.xml

所有Firebird用户都应升级到最新版本:

    # emerge --sync
    # emerge --ask --oneshot --verbose ">=dev-db/firebird-2.0.1"

Firebird
--------
目前厂商已经发布了升级补丁以修复这个安全问题,请到厂商的主页下载:

http://www.firebirdsql.org/rlsnotes/Firebird-2.0.1-ReleaseNotes.pdf

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