From 1f5fe9cd7b16ad2edd17ee8e13c672b3feeb9c08 Mon Sep 17 00:00:00 2001 From: _xeroxz Date: Sun, 8 Aug 2021 00:35:38 -0700 Subject: [PATCH] updated profiles... i need to update many more, i was lazy before... --- src/vmprofiles/add.cpp | 51 ++++++++++++++++++++++++++++++++++++--- src/vmprofiles/lconst.cpp | 5 +++- 2 files changed, 52 insertions(+), 4 deletions(-) diff --git a/src/vmprofiles/add.cpp b/src/vmprofiles/add.cpp index 883f69f..06e35a9 100644 --- a/src/vmprofiles/add.cpp +++ b/src/vmprofiles/add.cpp @@ -3,13 +3,22 @@ namespace vm::handler::profile { vm::handler::profile_t addq = { + // MOV RAX, [RBP] // ADD [RBP+8], RAX // PUSHFQ // POP [RBP] "ADDQ", ADDQ, NULL, - { { // ADD [RBP+8], RAX + { { // MOV RAX, [RBP] + []( const zydis_decoded_instr_t &instr ) -> bool { + return instr.mnemonic == ZYDIS_MNEMONIC_MOV && + instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[ 0 ].reg.value == ZYDIS_REGISTER_RAX && + instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_MEMORY && + instr.operands[ 1 ].mem.base == ZYDIS_REGISTER_RBP; + }, + // ADD [RBP+8], RAX []( const zydis_decoded_instr_t &instr ) -> bool { return instr.mnemonic == ZYDIS_MNEMONIC_ADD && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY && instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP && @@ -26,13 +35,31 @@ namespace vm::handler::profile } } } }; vm::handler::profile_t adddw = { + // MOV EAX, [RBP] + // SUB RBP, 0x4 // ADD [RBP+8], EAX // PUSHFQ // POP [RBP] "ADDDW", ADDDW, NULL, - { { // ADD [RBP+8], EAX + { { // MOV EAX, [RBP] + []( const zydis_decoded_instr_t &instr ) -> bool { + return instr.mnemonic == ZYDIS_MNEMONIC_MOV && + instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[ 0 ].reg.value == ZYDIS_REGISTER_EAX && + instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_MEMORY && + instr.operands[ 1 ].mem.base == ZYDIS_REGISTER_RBP; + }, + // SUB RBP, 0x4 + []( const zydis_decoded_instr_t &instr ) -> bool { + return instr.mnemonic == ZYDIS_MNEMONIC_SUB && + instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[ 0 ].reg.value == ZYDIS_REGISTER_RBP && + instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_IMMEDIATE && + instr.operands[ 1 ].imm.value.u == 0x4; + }, + // ADD [RBP+8], EAX []( const zydis_decoded_instr_t &instr ) -> bool { return instr.mnemonic == ZYDIS_MNEMONIC_ADD && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY && instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP && @@ -49,13 +76,31 @@ namespace vm::handler::profile } } } }; vm::handler::profile_t addw = { + // MOV AX, [RBP] + // SUB RBP, 0x6 // ADD [RBP+8], AX // PUSHFQ // POP [RBP] "ADDW", ADDW, NULL, - { { // ADD [RBP+8], AX + { { // MOV AX, [RBP] + []( const zydis_decoded_instr_t &instr ) -> bool { + return instr.mnemonic == ZYDIS_MNEMONIC_MOV && + instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[ 0 ].reg.value == ZYDIS_REGISTER_AX && + instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_MEMORY && + instr.operands[ 1 ].mem.base == ZYDIS_REGISTER_RBP; + }, + // SUB RBP, 0x6 + []( const zydis_decoded_instr_t &instr ) -> bool { + return instr.mnemonic == ZYDIS_MNEMONIC_SUB && + instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_REGISTER && + instr.operands[ 0 ].reg.value == ZYDIS_REGISTER_RBP && + instr.operands[ 1 ].type == ZYDIS_OPERAND_TYPE_IMMEDIATE && + instr.operands[ 1 ].imm.value.u == 0x6; + }, + // ADD [RBP+8], AX []( const zydis_decoded_instr_t &instr ) -> bool { return instr.mnemonic == ZYDIS_MNEMONIC_ADD && instr.operands[ 0 ].type == ZYDIS_OPERAND_TYPE_MEMORY && instr.operands[ 0 ].mem.base == ZYDIS_REGISTER_RBP && diff --git a/src/vmprofiles/lconst.cpp b/src/vmprofiles/lconst.cpp index d63e6a2..fdc828f 100644 --- a/src/vmprofiles/lconst.cpp +++ b/src/vmprofiles/lconst.cpp @@ -169,13 +169,16 @@ namespace vm::handler::profile vm::handler::extention_t::sign_extend }; vm::handler::profile_t lconstwsxq = { + // CWDE // CDQE // SUB RBP, 8 // MOV [RBP], RAX "LCONSTWSXQ", LCONSTWSXQ, 16, - { { // CDQE + { { // CWDE + []( const zydis_decoded_instr_t &instr ) -> bool { return instr.mnemonic == ZYDIS_MNEMONIC_CWDE; }, + // CDQE []( const zydis_decoded_instr_t &instr ) -> bool { return instr.mnemonic == ZYDIS_MNEMONIC_CDQE; }, // SUB RBP, 8 []( const zydis_decoded_instr_t &instr ) -> bool {