rootđź’€senseicat:~#

Hack. Eat. Sleep. Repeat!!!


Project maintained by SENSEiXENUS Hosted on GitHub Pages — Theme by mattgraham

Reverse



x86 architecture



Types of Malware



### X86 Assembly intro



Learning the Binary System


image


Examining 42 in decimal

>>> 10*16**0 + 2*16**1
42
>>> 5*16**0+15*16**1
245
>>>
>>> 13*16**0 + 12*16**1 + 1*16**2 + 15*16**3
61901
>>>

Transistors and Memory



X86 Architecture


image


General Purpose Registers


Subdividing EAX and other registers



Segment Registers




Instruction Pointer (EIP)



#include <stdio.h>
#include <stdlib.h>

void unreachableFunction(void) {
     printf("flag{hidden_function_12345678}\n");
}

int main(void) {
    printf("Hello World!\n")
    return 0;
}

❯ gcc -m32 -o eipexample eipexample.c
In file included from eipexample.c:1:
/usr/include/stdio.h:28:10: fatal error: bits/libc-header-start.h: No such file or directory
   28 | #include <bits/libc-header-start.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
set disassembly-flavor intel

image

image

image

image

image

image

image


Control Register Pointer



Flags


CF: Carry Flag
PF: Parity Flag
AF: Adjust Flag
ZF: Zero Flag
SF: Sign Flags
OF: Overflow Flag
TF: Trap Flag
IF: Interrupt Enable Flag
IOPL: I/O Privilege Level Flag
NT: Nested Task Flag
RF: Resume Flag
VM: Virtual-8086 Mode Flag
AC: Alignment Check Flag
VIF: Virtual Interrupt Flag
VIP: Virtual Interrupt Pending Flag
ID: Identification Flag

Stack


image


STACK OPERATIONS-: PUSH and POP


#include <stdio.h>
#include <stdlib.h>

void unreachableFunction(void) {
     printf("flag{hidden_function_12345678}\n");
}

int main(void) {
    printf("Hello World!\n");
    return 0;
}

image

image


Heap


image


ASSEMBLY -> Instruction Code Handling


int main(void) {
    return 0;
}
objdump -d -M intel test | grep main.: -A11

image