Security Testing Flashcards

1
Q

What is penetration testing (pentesting)?

A

the process of attacking a piece of software with the purpose of finding security vulnerabilities.
aka
hacking with permission

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

What is automated pen testing?

A
  • fuzzing or fuzz testing

- a systematic and repeatable approach to pentesting,

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

What is the aim of penetration testing?

A

To find vulnerabilities

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

What is a vulnerability?

A

A security hole in the hardware or software (including operating system) of a system that provides the possibility to attack that system

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

What are examples of vulnerabilities?

A
  • gaining unauthorised access (unescaped SQL commands)
  • stealing confidential information (weak, easy to guess passwords)
  • modifying/corrupting critical data (buffer overflows that permit access to memory outside of the running process)
  • crashing the system or make it unavailable to others (denial of service attack)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an SQL injection?

A

(answer this mentally)

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

What is a buffer overflow attack?

A

when data is written into a buffer (in memory) that is too small to handle the size of the data.

In some languages, the additional data simple overwrites the memory that is located immediately after the buffer. If carefully planned, attacker-generated data and code can be written here.

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

What are some ways to prevent security attacks?

A
  • defensive programming that checks for
    array bounds
  • using programming languages that do this automatically
  • finding and eliminating these problems via reviews and inspections
  • letting hackers find them for us (not recommended)
  • using verification techniques.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are examples of verification techniques?

A

fuzz testing

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

What is fuzz testing?

A

a (semi-)automated approach for penetration testing that

involves the randomisation of input data to locate vulnerabilities.

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

How does fuzz testing work?

A
  • a fuzz testing tool (or fuzzer) generates many test inputs - it monitors the program behaviour on these inputs
  • it looks for things such as exceptions, segmentation faults, and memory leaks; rather than testing for functional
    correctness.
  • Typically, this is done live: that is, one input is generated, executed, and monitored, then the next input, and so on.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the 3 techniques for fuzzing?

A
  1. Random testing
  2. Mutation-based fuzzing
  3. Generation-based fuzzing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is random testing?

A

tests generated randomly according to some probability distribution (possible uniform) to permit a large amount of inputs to be generated in an fast and unbiased way.

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

What are the advantages of random testing?

A
  • often (but not always) cheap and easy to generate random tests, and cheap to run many such tests
    automatically.
  • unbiased, unlike tests selected by humans. (useful for pentesting because the cases that are missed during programming are often due to lack of human understanding, and random testing may search these out)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the disadvantages of random testing?

A
  • A large number of test inputs may need to be generated in order to be confident that the input domain has been adequately covered.
  • The distribution of random inputs simply misses the program faults
  • It is highly unlikely to achieve good coverage.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Why is it hard to achieve good coverage with random testing?

A

If you have a series of conditions, e.g. x==y, then the probability of being able to generate that case can be very very low.

17
Q

What is Mutation based fuzzing?

A

starting with a well-formed input and randomly modifying (mutating) parts of that input rating (possibly invalid) test inputs.
- can be random or based on some heuristics.

18
Q

What are the advantages of fuzzing?

A
  • generally achieves higher code coverage than random testing.
  • issue of tricky branches still occurs but is less likely if the valid inputs that are mutated have the correct values to get past the tricky branches.
  • Even though the mutated tests may change these, some will change different parts of the input, and the e.g., checksum will still be valid.
19
Q

What are the disadvantages of fuzzing?

A
  • The success is highly dependent on the valid inputs that are mutated.
  • It still suffers from low code coverage due to unlikely cases (but not to the extent of random testing).
20
Q

What is generation based fuzzing?

A

using some specification of the input data, such as a grammar of the input to generate input as opposed to mutating existing input

  • generate data that is correct syntactically to the language being tested
  • generate data that is intelligent/ targeted as opposed to random
21
Q

What are the advantages of generation based fuzzers?

A

generally giving higher coverage as knowledge of the input protocol means that valid sequences of inputs can be generated that explore parts of the program (tricky branches)

22
Q

What are the disadvantages of generation based fuzzers?

A
  • Compared to random testing and mutation fuzzing, it requires some knowledge about the input protocol.
  • The setup time is generally much higher, due to the requirement of knowing the input protocol; although in some cases, the grammar may already be known (e.g., XML, RFC).
23
Q

What is a memory debugger?

A

a tool for finding memory leaks and buffer overflow

24
Q

Why are memory debuggers important?

A

because anomalies such as buffer overflows are difficult to observe using system behaviour
e.g. in stack buffer overflow, if the overflow is just by a few characters, it would be difficult to detect unless that particular part of memory is accessed again, which may not be the case.

25
Q

What issues are memory debuggers usually looking for?

A
  1. Uninitialised memory
  2. Freed memory
  3. Memory overflows
  4. Memory leaks
  • references made to memory blocks that are uninitialised at the time of reference.
  • reads and writes to/from memory blocks that have been freed.
  • writes to memory blocks past the end of the block being written to.
  • memory that is allocated but no longer able to be referenced.
26
Q

How do memory debuggers work?

A

By modifying the source code at compile type to include specific code that checks for memory issues; for example, by keeping track of a buffer size, and then inserting code directly before a write to check whether the memory being written is larger than the target buffer.

27
Q

What is the major downside to using memory debuggers?

A

performance cost - overhead of keeping track of the allocated memory, plus the checks made, is expensive.

28
Q

What is undefined behaviour?

A

something that a program does that causes its future behaviour to be unknown.

29
Q

What are examples of undefined behaviour in C?

A
  • Buffer Overflow
  • Dividing by 0
  • Dereferencing a NULL pointer
  • Overflowing a signed integer
  • Underflowing a signed integer
30
Q

What 3 properties constitute data security?

A
  1. Integrity
  2. Confidentiality
  3. Availability
31
Q

What is the integrity property of data security?

A

prevention of unauthorised data modification.

32
Q

What is the confidentiality property of data security?

A

prevention of unauthorised data disclosure.

33
Q

What is the availability property of data security?

A

ensuring attackers cannot deny legitimate access to data.

34
Q

Why is it harder to find security vulnerabilities that violate confidentiality?

A

integrity or availability violations ( e.g. when a program crashes due to a buffer overflow) are directly observable which is also why they can be caught via fuzzing.

However, the same is not always true for confidentiality violations and, for this reason, using testing to find such vulnerabilities is much harder.

35
Q

overt channels & covert channels

A

refer to notes