-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shellcode emulation issue #45
Comments
In order to better investigate shellcode emulation issues I converted a Python code I used long time ago while developing Pylibemu to use Speakeasy. The first analysis I performed seems to indicate that Unicorn detects some invalid memory read operations for a good number of the tested shellcodes which is probably something you may want to look at. Hope this helps. |
Thanks for the info, I'll look into this shortly. |
@drewvis just wanted to point out that version 1.4.8 totally broke up shellcode emulation. Apparently this started happening after the last set of PEB patches. Following an example of the same shellcode emulation using versions 1.4.7 and 1.4.8
|
Hey thanks, I'm looking into this right now. Other shellcode samples I have locally as tests still appear to be working. That example appears to be similar to a metasploit tcp bind shell. Can I reproduce this bug with that? |
Yes, that shellcode was generated using Metasploit. Attaching you a potentially useful Python script. Using the option -s you can select a shellcode to emulate (the example I posted was generated by running python sctest.py -s 1). Already commented out the code that performs shellcode analysis with pylibemu. Feel free to uncomment if you are interested in comparing the results. |
Ok, I believe I fixed the issue. What happened was the InInitializationOrderModuleList was corrected in the lasted release to remove the EXE from the linked list. However, the sample you are emulated appears to always expect kernel32 to be the 2nd loaded module in this list. By simply updating the default JSON config (86d7d71), the sample now emulates. |
Thanks for taking care of it. I performed a couple of tests and can confirm the patch fixes the issue. |
While attempting to build Speakeasy support in Thug [1] I spotted a potential shellcode emulation issue. Still had no time to investigate it (will do soon) but just wanted to point it out.
While analyzing a local sample I got these results
The shellcode profile is generated by libemu/pylibemu in this case. When attempting to analyze the exact same shellcode with Speakeasy I get
Let me point out this does not happen for every Thug local exploit sample but just a few of them.
[1] https://github.com/buffer/thug
The text was updated successfully, but these errors were encountered: