Control Hijacking - Defenses Flashcards

1
Q

Describe

Canaries

A

Placed in stack frames to prevent and detect overwritten return addresses since the value had to be verified against stored value after function execuation

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

List all control hijacking defenses

A
  • Canaries
  • Non-executable memory
  • Address Space Layout Randomization
  • Control Flow Integrity
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where are the canaries located?

A

After the return address

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

List the types of canaries

A
  • Terminator
  • Random
  • XOR
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe

Terminator Canary

A

Contains characters that prevents string functions to overwrite return address (i.e. NULL, CR, LF, EOF)

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

Describe

Random Canary

A

A random value chosen at the start and stored in an unmapped location to validate the code

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

Describe

XOR Canary

A

Random Value ^ Return Address; one bit must equal 1, not both

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

When are canaries recompiled?

A

At runtime

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

Limitations of Canaries

A
  • Can be learned
  • Doesn’t protect against stack smashing
  • Bypassable if other pointers are overwritten
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Describe

Non-Executable Memory

A

Memory that isn’t both writable and executable to prevent launchable code injections

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

Limitations of Non-Executable Memory

A
  • Bypassable if the function is returning into a libc
  • Hijacking existing code or gluing fragments still possible
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe

Address Space Layout Randomization

A

Maps the stack, heap, and code to random locations in memory

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

Limitations of Address Space Layout Randomization

A
  • Incurs overhead costs
  • Susceptible to address leack and other control hijack attacks
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Describe

Control Flow Integrity

A

Ensures outlined paths in CFG are followed and prevents jumping to invalid locations through indirect calls by reinforcing validity checks during run time

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

When are CGF built?

A

At compile time

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

Limitations to Control Flow Integrity

A
  • Hard to build accurately
  • Doesn’t prevent attacker from jumping to a valid wrong function
15
Q

Memory Corruption Vulnerabilities

What do humans do?

A

Make mistakes or not be situationally aware of various security threats/protective measures

16
Q

Memory Corruption Vulnerabilities

Not all ____ are safe

A

Languages

17
Q

Which language should be avoided?

A

C/C++

18
Q

Memory Corruption Vulnerabilities

Dealing with problems are ____ and ____

A

Expensive and difficult

19
Q

Ways to find security problems

A
  • Random inputs
  • Assumptions
  • Fuzz testing
  • Scanning
  • Penetration testing
20
Q

Define

Control Flow

A

The order/interpretation of the code during execution

21
Q

Describe

Control Flow Graph (CFG)

A

Reflects all possible paths during execution

22
Q

Parts of a CFG

A
  • Node/basic block
  • Directed edge
  • Path
23
Q

Parts of a CFG

Node/basic block

A

Code without branches

24
Q

Parts of a CFG

Directed edge

A

Branch with 1 entry/exit

25
Q

Parts of a CFG

Path

A

Collection of nodes connected; may or may not be feasible based on unreachable code, conditions, and input constraints