Skip to content

Commit ad85d2e

Browse files
committed
added xor,ret patch technique to inlinehooks
1 parent bd01702 commit ad85d2e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

volatility3/framework/plugins/windows/inlinehooks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def check_inline_hook(
8585
# This is important to avoid false positives on stub functions
8686
MIN_FUNC_SIZE_FOR_JMP = 2
8787
MIN_FUNC_SIZE_FOR_RET = 2
88+
MIN_FUNC_SIZE_FOR_XOR_RET = 3
8889
MIN_FUNC_SIZE_FOR_CALL = 2
8990

9091
if len(data) < 1:
@@ -139,6 +140,13 @@ def check_inline_hook(
139140
and disasm[0].mnemonic == "jmp"
140141
and disasm[1].id == capstone.x86.X86_INS_RET
141142
)
143+
or (
144+
func_insn_count >= MIN_FUNC_SIZE_FOR_XOR_RET
145+
and disasm[0].mnemonic == "xor"
146+
and disasm[0].operands[0].type == capstone.x86.X86_OP_REG
147+
and disasm[0].operands[1].type == capstone.x86.X86_OP_REG
148+
and disasm[1].id == capstone.x86.X86_INS_RET
149+
)
142150
):
143151
return (data, "Early RET")
144152

0 commit comments

Comments
 (0)