sábado, 27 de enero de 2024

Emulating Shellcodes - Chapter 2

 Lets check different  Cobalt Strike shellcodes and stages in the shellcodes emulator SCEMU.




This stages are fully emulated well and can get the IOC and the behavior of the shellcode.

But lets see another first stage big shellcode with c runtime embedded in a second stage.


In this case is loading tons of API using GetProcAddress at the beginning, then some encode/decode pointer and tls get/set values to store an address. And ends up crashing because is jumping an address that seems more code than address 0x9090f1eb.

Here there are two types of allocations:


Lets spawn a console on -c 3307548 and see if some of this allocations has the next stage.

The "m" command show all the memory maps but the "ma" show only the allocations done by the shellcode.



Dumping memory with "md" we see that there is data, and dissasembling this address with "d" we see the prolog of a function.

So we have second stage unpacked in alloc_e40064


With "mdd" we do a memory dump to disk we found the size in previous screenshot,  and we can do  some static reversing of stage2 in radare/ghidra/ida

In radare we can verify that the extracted is the next stage:


I usually do correlation between the emulation and ghidra, to understand the algorithms.

If wee look further we can realize that the emulator called a function on the stage2, we can see the change of code base address and  is calling the allocated buffer in 0x4f...



And this  stage2 perform several API calls let's check it in ghidra.


We can see in the emulator that enters in the IF block, and what are the (*DAT_...)() calls

Before a crash lets continue to the SEH pointer, in this case is the way, and the exception routine checks IsDebuggerPresent() which is not any debugger pressent for sure, so eax = 0;



So lets say yes and continue the emulation.


Both IsDebuggerPresent() and UnHandledExceptionFilter() can be used to detect a debugger, but the emulator return what has to return to not be detected. 

Nevertheless the shellcode detects something and terminates the process.

Lets trace the branches to understand the logic:


target/release/scemu -f shellcodes/unsuported_cs.bin -vv | egrep '(\*\*|j|cmp|test)'



Continuing the emulation it's setting the SEH  pointer to previous stage:


Lets see from the console where is pointing the SEH chain item:


to be continued ...


https://github.com/sha0coder/scemu






More articles
  1. Growth Hacker Tools
  2. Pentest Tools Apk
  3. Hack Apps
  4. Pentest Tools Url Fuzzer
  5. Pentest Tools Framework
  6. Nsa Hack Tools Download
  7. Hack Tool Apk No Root
  8. Hack Tools 2019
  9. Blackhat Hacker Tools
  10. Hack Tools For Pc
  11. Hacks And Tools
  12. Pentest Tools Find Subdomains
  13. Pentest Tools Apk
  14. Pentest Tools Apk
  15. Pentest Reporting Tools
  16. Blackhat Hacker Tools
  17. Hacking Tools For Windows
  18. Pentest Box Tools Download
  19. How To Hack
  20. Hack Rom Tools
  21. Pentest Tools Free
  22. Hack Tools
  23. Hack And Tools
  24. Hacking Tools For Kali Linux
  25. Pentest Tools Framework
  26. Pentest Tools Nmap
  27. Pentest Tools List
  28. Pentest Tools For Ubuntu
  29. Hacking Tools Online
  30. Hack Tools For Ubuntu
  31. Hacker Tool Kit
  32. Hack Rom Tools
  33. Hacking Tools Kit
  34. Hack Tools
  35. Hack Tools Pc
  36. Tools For Hacker
  37. Hak5 Tools
  38. Install Pentest Tools Ubuntu
  39. Tools Used For Hacking
  40. Hack Website Online Tool
  41. Hacker Tools For Ios
  42. Hacking Tools Software
  43. Tools 4 Hack
  44. Hacker Hardware Tools
  45. Pentest Tools Apk
  46. Hacker Techniques Tools And Incident Handling
  47. Pentest Tools Bluekeep
  48. Computer Hacker
  49. Hacking Tools Software
  50. Blackhat Hacker Tools
  51. Pentest Tools Tcp Port Scanner
  52. Hack Tools Online
  53. Pentest Tools Url Fuzzer
  54. Hacking Tools Software
  55. Hacker Tools Mac
  56. Hacker Search Tools
  57. Best Hacking Tools 2020
  58. Pentest Tools Review
  59. Pentest Automation Tools
  60. Hacker Tools For Ios
  61. Hacker Tools For Windows
  62. Black Hat Hacker Tools
  63. Hacking Tools Kit
  64. Hacking Tools For Mac
  65. What Is Hacking Tools
  66. Bluetooth Hacking Tools Kali
  67. Hacker Tools Free Download
  68. Hacking Tools Windows 10
  69. Computer Hacker
  70. Pentest Tools Url Fuzzer
  71. Hacking Tools For Kali Linux
  72. Hacking Tools Free Download
  73. Pentest Tools Website Vulnerability
  74. Pentest Tools Url Fuzzer
  75. Hacker Tools 2020
  76. Pentest Tools Bluekeep
  77. Hack And Tools
  78. Underground Hacker Sites
  79. Hacker Tool Kit
  80. Underground Hacker Sites
  81. Hack Tool Apk
  82. Bluetooth Hacking Tools Kali
  83. Hacking Tools For Kali Linux
  84. Game Hacking
  85. Hacker Tools Online
  86. Easy Hack Tools
  87. Pentest Tools Linux
  88. Hacking Tools Windows
  89. Hacking Tools Mac
  90. Black Hat Hacker Tools
  91. Github Hacking Tools
  92. Pentest Tools Open Source
  93. What Is Hacking Tools
  94. Pentest Tools Github
  95. Nsa Hacker Tools
  96. Hacking Tools 2020

0 comentarios:

Desarrollo Marítimo Isla San Lucas

Desarrollo Marítimo Isla San Lucas
Zona de Intervención