14. Memory Safety Flashcards

1
Q

What is an operating system?

A

Interface between applications and the hardware

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

What are the execution modes on unix?

A
  • user mode - kernel mode
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is user mode?

A

Access to resources through syscall to kernel

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

What is kernel mode

A

Direct access to resources

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

What is a process?

A

Program that is currently executing

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

What is a PID?

A

Process ID, used to identify a process

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

What is a fork?

A

Method by which a process starts a child process

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

How are file permissions represented in unix?

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

What’s a UID (unix)?

A

Real user ID, user that launched program

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

What is euid (unix)?

A

Effective user ID, user that owns program

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

What is the setuid property?

A

Sets euid of process to owner (as apposed to user that executed the program) to allow restricted access to sensitive resources

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

What direction does the heap grow?

A

Upwards

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

What direction does the stack grow?

A

Downwards

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

What does the text space contain?

A
  • Program instructions - Static data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the stack comprised of?

A

Stack frames

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

What is in a stack frame?

A
  1. Arguments
  2. Return address
  3. Stack frame pointer
  4. Exception handlers
  5. Local variables
17
Q

What is the EIP register?

A

Extended instruction pointer

18
Q

What is ESP register?

A

Extended stack pointer

19
Q

What is EBP register?

A

Extended base pointer, a more convenient way to access a functions parameters and local variables

20
Q

What does the calling function do?

A
  1. Push arguments onto stack 2. Push return address onto stack 3. Jump to function address
21
Q

What does the called function do?

A
  1. Push old frame pointer onto stack (edp) 2. Set frame pointer (ebp) to end of stack (esp) 3. Push local variables
22
Q

What does the returning function do?

A
  1. Reset previous stack frame: esp = ebd, ebd = (ebd)
  2. Jump to return address: eip = 4(esp)
23
Q

What does printf(“%08x”) do?

A

Since no arguments where provided, it will print 4 bytes from the stack

24
Q

What does printf (“12345%n”, &i) do?

A

Writes 5 (bytes written) into i

25
Q

What are stack canaries?

A

Add small random integer before return address on the stack, before returning check the stack canary, if it does not match the stack was corrupted.

26
Q

What is a return-to-libc attack?

A

Instead of the attacker injecting his own code, he points the return address to a usefull function in libc, which most C programs depend on

27
Q

What does ASLR stand for?

A

Address space layout randomization

28
Q

What does ASLR do?

A

Place system librarys (libc) in random locations, prevents return-to-libc attacks