improve Heaven's Gate detection for computed selector variants#1127
improve Heaven's Gate detection for computed selector variants#1127akshat4703 wants to merge 1 commit intomandiant:masterfrom
Conversation
|
I feel this is too narrow of a fix. We could easily change the 0x33 constructor to be something like
and the rule would be easily bypassed. I think the suggestions @devarjya27 suggested or detection for a |
Thanks for the feedback! You're right that the current rule is quite narrow and that the rule can be circumvented by making small changes in the construction of the constant. I'll look at the suggestions from @devarjya27 and see if I can create a more generic rule, perhaps by identifying the arithmetic construction of the constant and the usage of retf. I'll also see if I can find other examples of this technique in use and validate the rule against that, so that we don't end up overfitting the rule against a single example. Thanks for the guidance! |
This PR improves detection for
64-bit execution via heavens gateto cover obfuscated variants where the0x33selector is computed at runtime instead of used as an immediate constant.Fixes #1096.
Rule logic updates
Kept the existing strong pattern (
call $+5+add [esp], 5+retf) and corrected the selector setup clause to properly allow either:push 0x33, ormov 0x33Added a conservative secondary branch for the obfuscated selector construction pattern:
push 0x3shl ... , 0x4add ... , 0x3push 0x0retfAdded a reference to issue [64-bit execution via heavens gate] current rule misses obfuscated variants #1096 in
meta.references.Validation
capafmtpassed for the updated rule.lint --thorough -t "64-bit execution via heavens gate"passed.tests/data/79abd17391adc6251ecdc58d13d76baf.dll_tests/data/mimikatz.exe_-> no match for this rule.