Memory Safety and Violations Flashcards

1
Q

\what do hardening techniques need to be?

A

reliable and fast

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

What does a NX bit do?

A

block execution of writable sections on a hardware level

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

What do stack canaries do?

A

> generate random value (x)
when a function is called, save x on the stack
when the function returns, check if x has been tampered with

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

What are the advantages of stack canaries?

A

they are fast, reliable and ominous

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

What does ASLR stand for?

A

Address Space Layout Randomization

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

How do ASLRs work?

A

> add a random offset to data sections / dynamic libraries

> for a ret2libc, the attacker needs to know x

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

What are the advantages of ASLR?

A

fast, reliable, ominous

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

What do hardening techniques aim to do?

A

Bock an attack in case of a memory vulnerability.

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

What is full memory safety a combination of?

A

Spatial Memory Safety and Temporal Memory Safety

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

What is the principle of memory safety in space?

A

code should never read or write outside the memory area

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

What is the principle of memory safety in time?

A

memory should not be accessed before or after its lifetime

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

Explain a simplified process start

A

> place binary sections in memory
create a stack
main() starts

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

What pointers does a stack use?

A

stack pointer at the end, base pointer at the start

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

How does call work?

A

> saves location of last instruction
saves base pointer
sets base pointer to stack pointer
goes to start of new function

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

Give a quick summary of hacking the stack

A

> stack overflow
overwrite saved instruction pointer
attacker can choose what code executes next

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

How do you create a heap in C?

A

char *x = malloc(128);

17
Q

What does the heap need?

A

a dedicated heap manager