BCB编译器错误处理sizeof运算符漏洞

来源:互联网 发布:mac玩电脑游戏 编辑:程序博客网 时间:2024/05/16 17:46
BCB编译器错误处理sizeof运算符漏洞

发布日期:2006-02-06
更新日期:2006-02-06

受影响系统:
Borland C++Builder 6+ent_upd4
描述:
BCB(Borland C++ Builder)是一款流行的编译器。

BCB没有正确操作sizeof运算符,导致编译出来的代码可能嬖谡绯雎┒础?br />
由于没有正确的处理sizeof运算符,导致BCB 6(ent_upd4)编译器中存在整数溢出漏洞。攻击者可以利用这些漏洞远程执行任意代码。

<*来源:root (webmaster@xfocus.org)
  
  链接:http://www.xfocus.net/releases/200602/a849.html
*>

测试方法:

警 告

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

/**
* check_compiler_sizeof_vulnerability.c
*
* Check compiler whether correct deal with sizeof operator,
* which can cause integer overflow if you careless use !!!
*
* note: some old compiler have this vulnerability!!!!
*
* by alert7@xfocus.org
*
* XFOCUS Security Team
* http://www.xfocus.org
*
* already tested:
*
* BCB6+ent_upd4....................................vuln !!!
* gcc version 4.0.0 20050519 (Red Hat 4.0.0-8).....not vuln
* gcc version 2.95.3-4(cygwin special).............not vuln
* gcc version egcs-2.91.66.........................not vuln
* cc: Sun WorkShop 6 2000/04/07 C 5.1 .............not vuln
* VC6+sp5..........................................not vuln ,thank eyas
* lcc version 3.8..................................not vuln ,thank tombkeeper
* evc4+sp4.........................................not vuln ,thank san
*
* REQUEST YOUR COMMENT:
* VC6 not sp5......................................?
* VC7..............................................?
* evc not sp4......................................?
* freebsd gcc version..............................?
* openbsd gcc version..............................?
* ...
*/
#include <stdio.h>

int main(int argc, char *argv[])
{
        int i =-1;

        printf("Check compiler whether correct deal with sizeof operator/n");
        printf("  by alert7@xfocus.org /n/n");

        if (i > sizeof ( int ) )
        {
                printf("This compiler is not vuln/n");
        }else
                printf("This compiler is vuln!!!/n");

         getchar();

        return 0;
}

建议:
厂商补丁:

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

http://www.borland.com/downloads/download_cbuilder.html