@@ -43,14 +43,14 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
4343 requirements .VersionRequirement (
4444 name = "modules" ,
4545 component = modules .Modules ,
46- version = (3 , 0 , 0 ), # Updated from 2.0.0 to 3.0.0
46+ version = (3 , 0 , 0 ),
4747 ),
4848 requirements .VersionRequirement (
4949 name = "pe_symbols" , component = pe_symbols .PESymbols , version = (3 , 0 , 0 )
5050 ),
5151 requirements .ListRequirement (
5252 name = "pid" ,
53- description = "Filter on specific process IDs " ,
53+ description = "Process IDs to include (all other processes are excluded) " ,
5454 element_type = int ,
5555 optional = True ,
5656 ),
@@ -59,15 +59,18 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
5959 def _count_until_padding (self , data : bytes ) -> int :
6060 # Check for padding sequences
6161 for i in range (len (data )):
62+
6263 # Double int3 (CC CC)
6364 if i + 1 < len (data ) and data [i ] == 0xCC and data [i + 1 ] == 0xCC :
6465 return i
66+
6567 # 11-byte NOP (66 66 66 0f 1f 84 00 00 00 00 00)
6668 if (
6769 i + 11 <= len (data )
6870 and data [i : i + 11 ] == b"\x66 \x66 \x66 \x0f \x1f \x84 \x00 \x00 \x00 \x00 \x00 "
6971 ):
7072 return i
73+
7174 # 2-byte NOP (66 66)
7275 if i + 2 <= len (data ) and data [i : i + 2 ] == b"\x66 \x66 " :
7376 return i
@@ -139,16 +142,31 @@ def check_inline_hook(
139142 ):
140143 return (data , "Early RET" )
141144
142- # Check for JMP relative hooks
143- if disasm [0 ].bytes [0 ] == 0xE9 and func_insn_count >= MIN_FUNC_SIZE_FOR_JMP :
144- return (data , "JMP relative" )
145-
146- # Check for Early CALL hooks
147- if (
148- func_insn_count >= MIN_FUNC_SIZE_FOR_CALL
149- and disasm [0 ].mnemonic == "call"
150- ):
151- return (data , "Early CALL" )
145+ # Check for JMP relative/Register JMP hooks
146+ if func_insn_count >= MIN_FUNC_SIZE_FOR_JMP :
147+ if (disasm [0 ].bytes [0 ] == 0xE9 ) or (
148+ func_insn_count >= 2
149+ and disasm [0 ].mnemonic == "mov"
150+ and disasm [0 ].operands [0 ].type == capstone .x86 .X86_OP_REG
151+ and disasm [0 ].operands [1 ].type == capstone .x86 .X86_OP_IMM
152+ and disasm [1 ].mnemonic == "jmp"
153+ and disasm [1 ].operands [0 ].type == capstone .x86 .X86_OP_REG
154+ and disasm [1 ].operands [0 ].reg == disasm [0 ].operands [0 ].reg
155+ ):
156+ return (data , "Early JMP" )
157+
158+ # Check for Early CALL/Register CALL hooks
159+ if func_insn_count >= MIN_FUNC_SIZE_FOR_CALL :
160+ if (disasm [0 ].mnemonic == "call" ) or (
161+ func_insn_count >= 2
162+ and disasm [0 ].mnemonic == "mov"
163+ and disasm [0 ].operands [0 ].type == capstone .x86 .X86_OP_REG
164+ and disasm [0 ].operands [1 ].type == capstone .x86 .X86_OP_IMM
165+ and disasm [1 ].mnemonic == "call"
166+ and disasm [1 ].operands [0 ].type == capstone .x86 .X86_OP_REG
167+ and disasm [1 ].operands [0 ].reg == disasm [0 ].operands [0 ].reg
168+ ):
169+ return (data , "Early CALL" )
152170
153171 except Exception as e :
154172 vollog .debug (f"Error during disassembly at { addr :#x} : { e } " )
0 commit comments