diff --git a/windows/native_exec/simple_x64.py b/windows/native_exec/simple_x64.py index 1cbfaf0..8063a34 100644 --- a/windows/native_exec/simple_x64.py +++ b/windows/native_exec/simple_x64.py @@ -605,7 +605,7 @@ class ModRM_REG64__MEM(SubModRM): # Those registers cannot be addressed without SIB FIRE_UP_SIB = not arg2.base or arg2.base.upper() in ["RSP", "RBP"] or arg2.index - FIRE_UP_SIB = FIRE_UP_SIB or X64.is_new_reg(arg2.base) + FIRE_UP_SIB = FIRE_UP_SIB or X64.is_new_reg(arg2.base.upper()) if not FIRE_UP_SIB: self.setup_reg_as_register(arg1) @@ -620,7 +620,7 @@ class ModRM_REG64__MEM(SubModRM): # Handle no base and base == EBP special case if not arg2.base: force_displacement = 4 - elif arg2.base.upper() == "RBP": + elif arg2.base.upper() in ["RBP", "R13"]: force_displacement = 1 else: force_displacement = 0 diff --git a/windows/native_exec/test_simple_x64.py b/windows/native_exec/test_simple_x64.py index 087ce80..953c772 100644 --- a/windows/native_exec/test_simple_x64.py +++ b/windows/native_exec/test_simple_x64.py @@ -144,6 +144,15 @@ TestInstr(Mov)("R12", mem("[RAX]")) TestInstr(Mov)("RAX", mem("[R12]")) TestInstr(Mov)("RAX", mem("[RAX + R12]")) TestInstr(Mov)("RAX", mem("[R12 + R12]")) +TestInstr(Mov)("RAX", mem("[R12 + R15]")) + +TestInstr(Mov)("RAX", mem("[R10]")) +TestInstr(Mov)("RAX", mem("[R11]")) +TestInstr(Mov)("RAX", mem("[R12]")) +TestInstr(Mov)("RAX", mem("[R13]")) +TestInstr(Mov)("RAX", mem("[R14]")) +TestInstr(Mov)("RAX", mem("[R15]")) + #TestInstr(Mov)("RSI", mem("[R12]")) TestInstr(And)('RCX', 'RBX') diff --git a/windows/winobject/process.py b/windows/winobject/process.py index b2a3de5..e12b8d0 100644 --- a/windows/winobject/process.py +++ b/windows/winobject/process.py @@ -959,6 +959,16 @@ class WinProcess(Process): """Exit the process""" return winproxy.TerminateProcess(self.handle, code) +KNOW_INTEGRITY_LEVEL = [ +SECURITY_MANDATORY_UNTRUSTED_RID, +SECURITY_MANDATORY_LOW_RID, +SECURITY_MANDATORY_MEDIUM_RID, +SECURITY_MANDATORY_MEDIUM_PLUS_RID, +SECURITY_MANDATORY_HIGH_RID, +SECURITY_MANDATORY_SYSTEM_RID, +SECURITY_MANDATORY_PROTECTED_PROCESS_RID] + +know_integrity_level_mapper = {x:x for x in KNOW_INTEGRITY_LEVEL} # Create ProcessToken and Thread Token objects ? class Token(AutoHandle): @@ -979,7 +989,7 @@ class Token(AutoHandle): sid = ctypes.cast(buffer, POINTER(TOKEN_MANDATORY_LABEL))[0].Label.Sid count = winproxy.GetSidSubAuthorityCount(sid) integrity = winproxy.GetSidSubAuthority(sid, ord(count[0]) - 1)[0] - return integrity + return know_integrity_level_mapper.get(integrity, integrity) @property def is_elevated(self):