ayoubfaouzi / al-khaser

Public malware techniques used in the wild: Virtual Machine, Emulation, Debuggers, Sandbox detection.
GNU General Public License v2.0
5.95k stars 1.18k forks source link

Bugfix + new anti-disassembly technique #245

Closed Yp3rion closed 3 years ago

Yp3rion commented 3 years ago

The pull request deals with the following:

ayoubfaouzi commented 3 years ago

Hey @Yp3rion

Thanks for your first contribution :)

I will review this one today.

ayoubfaouzi commented 3 years ago

That was a good catch ! I was wondering how did you track the problem back to the trap flag issue and I started debugging from there and I figured out that in the VEH handler, when we increase the instruction pointer, we end up returning right after the RemoveVectoredExceptionHandler, so the VEH never get deleted, and it keps catching exceptions and somehow failed in the the wine check.

As a matter of fact, I also checked the x64 version and it does not need to advance RIP as well, you should get rid of it as it as well.

I will look into the anti disassm tomorrow.

Thank you.

Yp3rion commented 3 years ago

Perfect! I am happy to help and I was curious about the underlying issue since I have to admit I did not go much into detail after finding the bug, so thank you for explaining; I will make sure to fix the x64 version too then, should I do it after this pull request is approved or is it possible to edit a pull request on the fly? (I am a bit of a noob, I know)

ayoubfaouzi commented 3 years ago

No worries, just modify the code, make a commit and push, it should appear here.

ayoubfaouzi commented 3 years ago

Looks awesome ! Thank you again.