Reverse Engineering a #CobaltStrike #malware sample and extracting C2's using three different methods.
We'll touch on #cyberchef, #x64dbg and Speakeasy from fireeye to perform manual analysis and emulation of #shellcode.
A (big) thread ⬇️⬇️
[1/23]
We'll touch on #cyberchef, #x64dbg and Speakeasy from fireeye to perform manual analysis and emulation of #shellcode.
A (big) thread ⬇️⬇️
[1/23]
[2/23]
To follow along, download the sample from the link below. Then transfer the .zip into a safe VM environment.
My VM is a mostly default Flare VM with SpeakEasy installed on top.
bazaar.abuse.ch
To follow along, download the sample from the link below. Then transfer the .zip into a safe VM environment.
My VM is a mostly default Flare VM with SpeakEasy installed on top.
bazaar.abuse.ch
[4/23] Taking this into account, drag the file into x64dbg to #debug the file. Once the file is loaded, let it run until the EntryPoint is hit by pressing F9.
In my case, nothing happened if I let the malware run continue to execute past the EntryPoint.
In my case, nothing happened if I let the malware run continue to execute past the EntryPoint.
[5/23] Instead, let the malware run from the DllRegisterServer export, since this is a common place that malware will place #malicious code.
To do this, load the file again and browse to the "Symbols" tab in x64dbg.
To do this, load the file again and browse to the "Symbols" tab in x64dbg.
[16/23] To use an emulator, download the speakeasy tool from Github and install it on your machine.
Then run "python run_speakeasy.py -r -a x64 -t shellcode.bin" making sure your shellcode file is in the unzipped speakeasy folder.
github.com
Then run "python run_speakeasy.py -r -a x64 -t shellcode.bin" making sure your shellcode file is in the unzipped speakeasy folder.
github.com
[17/23] To use #cyberchef
- copy the bytes from your dump.
- "From Hex" and "Strings" on your pasted bytes.
- Play around with the "Min Length" option for cleaner output.
- copy the bytes from your dump.
- "From Hex" and "Strings" on your pasted bytes.
- Play around with the "Min Length" option for cleaner output.
[18/23] To use x64dbg to extract C2's, continue execution from the start of your #Shellcode.
1⃣ Step into the first function call (using F7).
2⃣ Set breakpoints on all "call rbp" (F2)
3⃣ Continue execution (F9)
1⃣ Step into the first function call (using F7).
2⃣ Set breakpoints on all "call rbp" (F2)
3⃣ Continue execution (F9)
[21/23] Another Bonus #RE Tip:
You can "step into" (F7) the "call rbp" instructions.
This will take you to the API hashing code.
The first part of that looks like this, and involves traversing a PEB/TEB table and calculating a ROR13 hash.
You can "step into" (F7) the "call rbp" instructions.
This will take you to the API hashing code.
The first part of that looks like this, and involves traversing a PEB/TEB table and calculating a ROR13 hash.
[22/23] That's it for this thread!
I'll expand on some of these techniques and concepts in later threads. Stay tuned 😃
(leave a comment if there's anything you'd like me to expand more on)
I'll expand on some of these techniques and concepts in later threads. Stay tuned 😃
(leave a comment if there's anything you'd like me to expand more on)
[23/23]
If you're interested in learning more about Cobalt Strike shellcode and API hashing.
Check out my blog with @HuntressLabs
huntress.com
If you're interested in learning more about Cobalt Strike shellcode and API hashing.
Check out my blog with @HuntressLabs
huntress.com
جاري تحميل الاقتراحات...