Immunity Debugger Flashcards

1
Q

F9

A

run program

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

F7

A

step

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

ctrl+F2

A

restart program

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

alt+C

A

cpu view

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

ASM instruction syntax

A

ADD/SUB op1, op2 — add or subtract two operands, storing the result in the first operand. These can be registers, memory locations (limit of one) or constants. For example, ADD EAX, 10 means add 10 to the value of EAX and store the result in EAX
XOR EAX, EAX — Performing an ‘exclusive or’ of a register with itself sets its value to zero; an easy way of clearing the contents of a register
INC/DEC op1– increment or decrement the value of the operand by one
CMP op1, op2 — compare the value of two operands (register/memory address/constant) and set the appropriate EFLAGS value.
Jump (JMP) and conditional jump (je, jz, etc) — as the name implies these instructions allow you to jump to another location in the execution flow/instruction set. The JMP instruction simply jumps to a location whereas the conditional jumps (je, jz, etc) are taken only if certain criteria are met (using the EFLAGS register values mentioned earlier). For example, you might compare the values of two registers and jump to a location if they are both equal (uses je instruction and zero flag (zf) = 1).
When you see a value in brackets such as ADD DWORD PTR [X] or MOV eax, [ebx] it is referring to the value stored at memory address X. In other words, EBX refers to the contents of EBX whereas [EBX] refers to the value stored at the memory address in EBX.
Relevant size keywords: BYTE = 1 byte, WORD = 2 bytes, DWORD = 4 bytes.

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

alt+M

A

memory map view

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

memory map

A

http://www.securitysift.com/wp-content/uploads/2013/12/Screen-Shot-2013-11-30-at-1.35.49-PM.png

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

stack

A

grows ‘up’ to lower memory addresses

Unlike the heap, where memory allocation for global variables is relative arbitrary and persistent, the stack is used to allocate short-term storage for local (function/method) variables in an ordered manner and that memory is subsequently freed at the termination of the given function. Recall how a given process can have multiple threads. Each thread/function is allocated its own stack frame. The size of that stack frame is fixed after creation and the stack frame is deleted at the conclusion of the function.

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

heap

A

grows ‘down’ to higher memory addresses

The heap is the dynamically allocated (e.g. malloc( )) portion of memory a program uses to store global variables. Unlike the stack, heap memory allocation must be managed by the application. In other words, that memory will remain allocated until it is freed by the program or the program itself terminates. You can think of the heap as a shared pool of memory whereas the stack, which we’ll cover next, is more organized and compartmentalized. I won’t go too much deeper to the heap just yet but plan to cover it in a later post on heap overflows.

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

PEB

A

Process Environment Block

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

!peb

A

WinDbg command to view PREB

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

symbol files

A

it’s especially helpful to load the appropriate symbol files when debugging Windows applications as they provide useful, descriptive information for functions, variables, etc. You can do so within WinDbg by navigating to “File –> Symbol File Path…”. Follow the instructions found here: http://support.microsoft.com/kb/311503. You can also load symbol files in Immunity by navigating to “Debug –> Debugging Symbol Options”.

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

DLLs

A

Windows programs take advantage of shared code libraries called Dynamic Link Libraries (DLLs) which allows for efficient code reuse and memory allocation. These DLLs (also known as modules or executable modules) occupy a portion of the memory space. As shown in the Memory Map screenshot, you can view them in Immunity in the Memory view (Alt+M) or if you want to only view the DLLs you can select the Executable Module view (Alt+E). There are OS/system modules (ntdll, user32, etc) as well as application-specific modules and the latter are often useful in crafting overflow exploits (covered in future posts).

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

Program Image

A

The Program Image portion of memory is where the executable resides. This includes the .text section (containing the executable code/CPU instructions) the .data section (containing the program’s global data) and the .rsrc section (contains non-executable resources, including icons, images, and strings).

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

Stack Frames

A

When a program function executes, a stack frame is created to store its local variables. Each function gets its own stack frame, which is put on top of the current stack and causes the stack to grow upwards to lower addresses.

Each time a stack frame is created, a series of instructions executes to store function arguments and the return address (so the program knows where to go after the function is over), save the base pointer of the current stack frame, and reserve space for any local function variables. [note: I’m intentionally omitting exception handlers for this basic discussion but will address them in a later post].

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