title: Anti Disassembly Techniques date: 2021-01-13 categories: [cheatsheets]
_start:
push ebp
mov ebp, esp
xor eax, eax
jz jump+1
jnz jump+1
jump:
nop
push eax
push ebx
push ecx
Result in BinaryNinja: Interprets the 0xe8 as call instruction, still continues the correct execution! No result in IDA Pro.
_start:
push ebp
mov ebp, esp
xor eax, eax
jz jump
nop ; define this as 0xe8
jump:
push eax
push ebx
push ecx
One Byte is together in two instructions
inc eax
-----
hex: EB FF C0 48
----- **
instr: jmp-1 dec eax
the EBB FF jumps in the middle of the jump instruction, therefor being FF C0 the next instruction (inc eax)
then 48 as dec eax
Works in IDA Pro
Binary Ninja can disassembly this
simply insert "EB FF C0 48" at any position
like a complicated NOP-Instruction
section .text
global _start
_start:
push ebp
mov ebp, esp
jmp $-1 ; change sec. Byte to FF
nop ; change to 0xC0
dec eax
; do your stuff here
push eax
push ebx
push ecx
mov [ebp+0x8], offset sub_12342
push 0x1
push 0x2
call [ebp+0x8]
...
..
..
call [ebp+0x8]
call $+5 ; pushes next addr on the stack
add [esp+4+var_4], 5 ; add 5 to the stack (-> So the address points to the 'real function')
retn
---------------------------------
push ebp ; real function, not found by IDA pro because of the return instruction
mov ebp, esp
...
..
.
xor ecx, ecx div exc ; force an exception by dividing by zero
```