Comp Security- Week 4 Flashcards

1
Q

What register is the instruction pointer?

A

EIP

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

The EIP register is…

A

The instruction pointer; points to address. It holds the address of the next instruction inside of memory to be executed

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

What are the EFLAGS Registers?

A

Flags for logical conditions (true/false); condition codes

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

What are ESP AND EBP used for?

A

Related to stack pointer; created when we have functions called

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

In AT&T which comes first source or destination?

A

Source before destination

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

In Intel which comes first source or destination?

A

Destination before Source

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

Suppose we have ebx=eax how would it look like in At&T syntax, how in Intel?

A

AT&T: movl %eax, %ebx
Intel: mov ebx, eax

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

The GDB debugger provides a direct method to examine memory using command…

A

x

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

x/11xb main means

A

Examine 11 bytes in hexadecimal starting at main

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

x/2xw $eip means

A

Examine 2 words (4bytes) in hexadecimal at $eip

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

x/i $eip means

A

Display the memory as disassembled assembly language instructions

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

List the memory layout from high address to low address

A

Stack, heap, data, text

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

Stack

A

Memory allocated temporarily when we have a function call, procedure call, etc. It stores information
Ex. Local variables that are mainly used for function calls

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

Heap

A

Dynamically allocated storage (Dynamically= i dont know its size)
Ex when call malloc() calloc() new()

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

Data

A

Statically (i know its size) allocated memory thats declared in code
Ex. String, array

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

Text

A

Executable machine instructions, read only

17
Q

A stack frame provides..

A

A stack frame provides space for these values (local variables, parameters, return values)

18
Q

What is stack discipline?

A

LIFO (last in first out)

19
Q

Stack frame contents :

A

Local variables, return information, temporary space

20
Q

Stack frame management

A

Space allocated when enter procedure and deallocated when return

21
Q

What are the two stack pointers?

A

Base/Frame pointer %ebp and Stack pointer %esp

22
Q

Why do we need two pointers in stack and what do they do?

A

Base/Frame pointer: Doesnt move or change
Stack pointer: At the top of stack
When you push stack increments by 1 and when you pull/pop stack decrements by 1
When theyre equal stack is empty

23
Q

When is stack created? When is it deleted?

A

Stack is created when there is a function call
Stack is deleted when the base/frame and stack pointer are equal

24
Q

A call is made, a stack is created and now the stack is no longer referenced by base/frame pointer or stack pointer. Will the info inside the memory be deleted or stay?

A

The info will remain it wont delete but the reference to them wont be there.

25
Q

Buffer overflow occurs when..

A

Buffer overflow occurs when data is written outside the boundaries of the memory allocated to a particular data structure

26
Q

Buffer overflows can be exploited to modify..

A

a variable, data pointer, function pointer, or return address on the stack

27
Q

A modified variable due to buffer overflow may be used to

A

change important info, change the behavior of the program

28
Q

A modified pointer or return address due to buffer overflow may be used to

A

can allow execution of arbitrary code

29
Q

Internally a program stack is used to..

A

To keep track of a program execution and state by storing:
1. return address in the calling function
2. arguments to the functions
3. local variables (temporarily)

30
Q

The program stack /stack is modified during

A

During function calls, function initialization, when returning from a subroutine

31
Q

The esp stack pointer holds the top stack address and it can be modified..

A

directly- by direct operations ex. add esp, 08h shrinks stack by 2 words or 8 bytes
indirectly- push or pop operations (adding/removing data elements)

32
Q

The amount of memory required to store is a string is..

A

The # of characters + 1

33
Q

Buffer overflow prevention:

A
  1. use functions that respect buffer bounds such as fgets, strncpy, strncat
  2. ensure null termination of strings
  3. invalidate stack execution since stack based buffer overflows are the easiest to exploit
  4. make sure the format string argument is explicitly specified
  5. static analysis and dynamic analysis testing
  6. run time safe guards