-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
ModuleMap: support packed/obfuscated Windows binaries #448
Comments
|
hh2.golden.tar.xz.txt Here you go, just need to remove the trailing '.txt', GitHub didn't like the tar.xz upload. |
For hh2, the binary has overlapping sections, the ModuleMap plugin can't keep track of them, so ModuleExecutionDetector can't figure out which section is executing, resulting in loss of coverage in TranslationBlockCoverage. I think that the fix would be to support overlapping sections in ModuleMap. |
This is a quick fix: S2E/s2e#39 |
@BMorgan1296 does the fix work for you? |
The small test programs did fully complete execution, however I received no coverage for DPE64small. So better than without the fix! I'll be trialling the plug-in changes over a larger sample size of Windows binaries soon. |
I see, I didn't get a chance to run on DPE64small, only hh2. |
I tried to run DPE64small. This one is complicated, I can't even disassemble it in IDA. It doesn't seem to have any sections. If you explain to me how Windows loads and runs such binaries, I may be able to make a fix. |
Let me know how this is going, on my side, the testsuite passes so I guess it's mergeable. I was thinking of adding hh2 to the testsuite, but I'd rather not include a binary there, especially when virustotal finds it suspicious. Is this some malware sample? If not, let me know if you have source code for it. |
By the way, you need to call your binary dpe64small.exe, lower case. See this issue: #452 |
S2E parses the location of executable sections in the binary. If parsing fails for some reason, it will not be able to locate the binary in the address space and coverage recording will fail. S2E relies on the libvmi library to parse PE files. It has a tool you can use to dump the binaries' sections: Here is how sections would look like on a normal binary:
Here is how they look like on hh2.golden.exe. You can see that some values are strange. Virtual addresses and sizes seem incorrect, but S2E still tolerates it. You'd still get coverage because the start/size accidentally contain the actual binary.
For dpe64small.exe, it cannot parse anything. IDA could not open it either.
I don't know how Windows loads these binaries, maybe it uses other things than segments. You will have to explain that to me, I don't have time to investigate it myself. |
Hi, Found the issue I was having with code coverage! Rookie mistake. The windows binaries I was testing did not have file extensions. As soon as I appended ".exe", code coverage magically started working. Using the dump tool above showed them to look normal so I knew I could assume it wasn't an issue with the binaries themselves. I believe this issue can be closed now. At least it was a quick fix! |
Hi,
I am having an issue where no coverage info is generated (i.e. tbcoverage-0.json is empty) due to
Vmi: Could not find host path for s2e.sys
, and the same error but for the binary itself.I assume the ‘host’ here is the machine I have S2E installed on, therefore the guest tools and binary should be in the project folder? I don’t see why they wouldn’t be known to S2E during execution.
I have tried executing binaries using the following Windows images:
Windows 10 Pro 1909-x86_64
using provided s2e.sysWindows 10 Pro 2004-x86_64
with a custom built s2e.sys for the differing kernelWindows 7 SP1 x86_64
using provided s2e.sysI’ve followed all the build steps to the best of my ability, everything seems to be alright. If I enable GUI when executing the binary, I can see things happening in the terminal, but I don’t see the “hello world” output due to s2e.sys not being loaded. Execution takes significantly longer as well.
Code coverage on linux binaries works fine in contrast.
Here is my warnings.txt for a small binary where every byte runs.
And then for a hello world program:
Any ideas?
The text was updated successfully, but these errors were encountered: