Reverse engineering & Linux Flashcards

1
Q

What type of architecture is x86-64 (amd64, i64)?

A

64-bit CISC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some properties of CISC?

A

A single instruction can do multiple things at once (mem access, register read, etc.)

Variable length instruction set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the x86-64 architecture?

A

CISC

The registers used extend an extra 32-bit on the Intel’s x86 architecture

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a property of x86-64?

A

The architecture allows for a multi-sized register access, meaning you can access certain parts of a register which are different sizes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can multi-sized access be done?

A

The RAX register can have it’s lower 32-bits accessed using EAX.

The lower 16 bits can be accessed using AX.

The lower 8-bits can be accessed using AL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How is the x86-64 registers structured?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the RAX register in x86-64?

A

64-bit “long” register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the EAX register in x86-64?

A

32-bit “int” register

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Name 3 special registers in x86

A

RIP: Instruction pointer

RSP: Stack pointer

RBP: Base pointer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How are instructions executed in x86?

A

Fetch instruction at address in RIP

decode it

run it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Explain the following instruction:
mov rax, 0xdeadbeef

A

Mov the immediate “0xdeadbeef” into register rax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Explain the following instruction:
mov rax, [0xdeadbeef + rbx * 4]

A

Move the data at address “0xdeadbeef + rbx * 4” into rax

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are conditionals used in x86?

A

Use jumps and jump if the provided conditional is true:
- jnz <address>
- je <address>
- jge <address>
- jle <address>
- etc.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the conditional jump-flags check?

A

Checking EFLAGS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are EFLAGS?

A

Special registers that stores flags on certain instructions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Give an example of flags that EFLAGS store

A

The instruction “add rax, rbx” sets the o flag (overflow) if the sum is greater than what the 64-bit register can hold, and wraps around.

This flag is used to jump by the jo instruction

17
Q

What instruction is often used in combination with jumps?

A

cmp

Example:
cmp rax, rbx
jle error

18
Q

Name 4 vulnerable C-functions

A

gets
strcpy
strcat
strcmp

19
Q

What C-functions can cause buffer overflows?

A

gets
strcpy
strcat

20
Q

What C-function can cause timing attacks?

A

strcmp

21
Q

What is a disassembler?

A

A tool that breaks down a compiled program into machine code

22
Q

What is IDA?

A

Industry standard for binary disassembly

23
Q

What is IDA’s Hex Rays decompiler?

A

A feature in IDA which can convert assembly code back into a pseudo code like format

24
Q

What is pwndb?

A

A GDB plug-in that solves a lot of problems with vanilla GDB obscuring a lot of information and being unintuitive.

25
Q

How can you get the dissassembly of a program using gdb?

A

gdb program

Display disassembly of frame/function:
(gdb) disassemble [address/symbol]

Display disassembly of main:
(gdb) disas main

26
Q

What is the gdb command:

display/[# of instructions]i $pc [± offset]

A

Display: shows data with each step

/[#]i: shows how much data in the format i for instruction

$pc: means the pc register

27
Q

What does the DGB command “display/10i $pc - 0x5” do?

A

Displays the 10 instructions on screen with an offset from the next instruction of 5

28
Q

When listing processes using ps -o stat, what does the different stats mean?

A

T: suspended
S: sleeping while waiting for input
R: Running
+: Process is in the foreground

29
Q

What does it mean that a process is running in the foreground?

A
30
Q

What does it mean that a process is running in the background?

A
31
Q

What does a file type “c” mean?

A

The file is a “character device” meaning interacting with it results in changes to the display output rather than changes to disk storage (as for a normal file)

32
Q

What does rwx permissions allow for directories?

A

r: List the directory
w: Create/delete files in directory
x: Enter the directory using cd

33
Q

What is the shell variable PATH?

A

Stores directory paths in which the shell will search for programs corresponding to commands.