Docsity

TaintScope - Malware and Software Vulnerability Analysis - Lecture Slides, Slides of Software Engineering

Partial preview of the text

Download TaintScope - Malware and Software Vulnerability Analysis - Lecture Slides and more Slides Software Engineering in PDF only on Docsity!

TaintScope: A Checksum-Aware Directed Fuzzing Tool for Automatic Software Vulnerability Detection

Checksum

  • A common way to check the integrity of data
  • Widely used in network protocols and many file formats
  • Checksum algorithms –Alder-32, CRC, MD5.

2

data

data Checksum field

Checksum function

Dynamic Taint Analysis

  • Tracks the information flow within a program by - associating one or more markings with some data values in the program - propagating these markings as data values flow through the program during execution

Example code - Explicit information

flow

1 i n t a , b , w, x , y , z ; 2 a = 1 1 ; 3 b = 5 ; Taint variable a, b with marking t a and t b 4 w = a ∗ 2 ; 5 x = b + 1 ; 6 y = w + 1 ; 7 z = x + y ; At the end of execution taint marking are w-> {ta} x -> {tb} y -> {ta} z -> {ta , tb}

Symbolic Execution

  • Analysis of programs by tracking symbolic rather than actual values
  • Used to reason about all the inputs that take the same path through a program

Symbolic Execution Example

8

Code:

(PC=“path constraints”)

  • “Simulate” the code using symbolic values instead of program numeric data

Symbolic execution tree:

Example Code

1 void decode_image(FILE* fd){ 2 ... 3 int length = get_length(fd); 4 int recomputed_chksum = checksum(fd, length); 5 int chksum_in_file = get_checksum(fd); //line 6 is used to check the integrity of inputs 6 if(chksum_in_file != recomputed_chksum) 7 error(); 8 int Width = get_width(input_file); 9 int Height = get_height(input_file); 10 int size = WidthHeightsizeof(int); //integer overflow 11 int* p = malloc(size); 12 ... 13 for(i=0; i<Height;i++){// read ith row to p 14 read_row(p + Width*i, i, fd); //heap overflow

If the two values mismatch, the code raises an error and exits immediately. (^10)

re-compute a new checksum

Read the attached checksum

compare two values

The Key Idea

  • To infer whether/where a program checks the integrity of input instances
  • Identify which input bytes can flow into security-sensitive points - Taint analysis at byte level – monitors how application uses the input data.
  • Create malformed input focusing the “hot bytes”
  • Repair checksum fields in input, to expose vulnerability (^) Docsity.com^11

TaintScope – Four Phases of Execution

  1. Dynamic Taint Tracing
    • Hot Byte Information
    • Checksum Information
  2. Detecting Checksum Check Points
  3. Directed Fuzzing
    • Based on hot bytes information generate malformed test cases
    • Bypass Checksum check points to allow malformed input to propagate

4.Repair Crashed Samples

  • Fixing checksum field in test cases

TaintScope System Overview

Dynamic Taint Tracing

  • Instruments instructions - data movement (e.g.,MOV, PUSH), arithmetic (e.g., SUB, ADD), and logic (e.g., AND, XOR).
  • Taints all values written by an instruction with the union of all taint labels associated with values used by that instruction
  • The eflags register is also considered.

16

eax {0x6, 0x7}, ebx {0x8, 0x9} add eax, ebx eax {0x6, 0x7, 0x8, 0x9}, eflags {0x6, 0x7, 0x8, 0x9}

Dynamic Taint Tracing - Example

  • Size of Input File is 1024 bytes
  • Analysts are interested in the size argument of memory allocation function malloc()  Hot bytes report will include entry: 0x8048d5b: invoking malloc: [0x8,0xf]  Explanation - Instruction at 0x8048d5b calls function malloc and the size argument depends on input bytes in the range from 0x8 to 0xf
  • Analyst are interested in input bytes on which JZ conditional jump instruction depends  Checksum information report will include entry 0x8048d4f: JZ: 1024: [0x0, 0x3ff]  Explanation - the conditional jump instruction JZ at 0x8048d4f depends on 1024 input bytes in the range from 0x0 to 0x3ff.

Detecting Checksum

Refinement:

Well-formed inputs can pass the checksum test, but most malformed inputs cannot

Detecting Checksum

Refinement:

Well-formed inputs can pass the checksum test, but most malformed inputs cannot

  • Run well-formed inputs, identify the always-taken and always- not-taken instructions.