首页 -> 安全研究

安全研究

安全漏洞
Interbase ISC_LOCK_ENV环境变量本地缓冲区溢出漏洞

发布日期:2003-04-03
更新日期:2003-04-07

受影响系统:
Borland/Inprise Interbase 6.x
描述:
CVE(CAN) ID: CVE-2003-0197

Interbase是一款由Borland公司开发和维护的数据库软件,可使用在多种Unix和Linux操作系统。

Interbase对ISC_LOCK_ENV环境变量缺少正确边界缓冲区检查,本地攻击者可以利用这个漏洞进行缓冲区溢出攻击,可能以root用户权限在系统上执行任意指令。

Interbase gds_lock_mgr用于检查ISC_LOCK_ENV变量,如果ISC_LOCK_ENV变量超过1024字符,就会发生段错误,问题存在于gds.c的strcat()函数调用中:

./common.h:#define MAXPATHLEN 1024
./gds.c:714:#define ISC_LOCK_ENV "INTERBASE_LOCK"
./gds.c:425:static char ib_prefix_lock_val[MAXPATHLEN];


void API_ROUTINE gds__prefix_lock (
    TEXT *string,
    TEXT *root)
/********************************************************
*
* g d s _ $ p r e f i x _ l o c k ( n o n - V M S )
*
********************************************************
*
* Functional description
* Find appropriate InterBase lock file prefix.
* Override conditional defines with the enviroment
* variable INTERBASE_LOCK if it is set.
*
**************************************/
string [0] = 0;


if (ib_prefix_lock == NULL)
    {
    if (!(ib_prefix_lock = getenv (ISC_LOCK_ENV)))
        {
        ib_prefix_lock = ib_prefix_lock_val;
        gds__prefix(ib_prefix_lock, "");
        }
    else
        {
        strcat (ib_prefix_lock_val, ib_prefix_lock); // 问题所在处
        ib_prefix_lock = ib_prefix_lock_val;
        }
    }

精心构建超长的环境变量数据,可能以root用户权限在系统上执行任意指令。

<*来源:KF (dotslash@snosoft.com
  
  链接:http://marc.theaimsgroup.com/?l=bugtraq&m=104940730819887&w=2
*>

建议:
临时解决方法:

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

* chmod -s /path/to/gds_lock_mgr

* 修改gds.c文件中的gds__prefix_lock()函数的strcat()调用为strncat()函数:

strncat (ib_prefix_lock_val, ib_prefix_lock, sizeof(ib_prefix_lock_val)-1);

厂商补丁:

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

http://www.borland.com/interbase/

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