23
School of Electrical Engineering and Computer Science University of Central Florida Improving Software Security via Runtime Improving Software Security via Runtime Instruction Instruction - - Level Taint Checking Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

School of Electrical Engineering and Computer ScienceUniversity of Central Florida

Improving Software Security via Runtime Improving Software Security via Runtime InstructionInstruction--Level Taint CheckingLevel Taint Checking

Jingfei Kong, Cliff C. Zou and Huiyang Zhou

Page 2: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 2

OutlineOutline

• Motivation• Design• Experiments• Applications• Conclusion

Page 3: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 3

LowLow--level Memory Vulnerabilitieslevel Memory Vulnerabilities

• Program defects– Unsafe languages (C /C++) do not check/restrict memory accesses– Buffer Overflow, Heap Corruption, Format String …– Result in many kinds of exploits – major threats to the internet

• No Silver bullet so far– Hard to find and fix defects in advance– Exploit-focused solutions can always be bypassed.– Defect-focused solutions are costly

Page 4: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 4

Tainting ArchitecturesTainting Architectures

Corrupteddata used asjump target

address

suspicious data

suspicious data corrupt other data

suspicious data labeled as tainted data

tainted data taint other data

Page 5: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 5

NonNon--control Data Attacks and Pointer control Data Attacks and Pointer TaintednessTaintedness CheckingChecking

• Security-Critical Non-Control Data (Chen’ Usenix Security 2005)– Configuration data– User input– User identity data– Decision-making data– Conclusion: as effective as the well-known control data attacks

• Pointer Taintedness Checking (Chen’ DSN 2005)– Tainted data are not allowed to be used as pointers– Untaint tainted data only when compared with untainted value

Page 6: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 6

Problems with Pointer Problems with Pointer TaintednessTaintedness CheckingChecking

void information_leakage(){

unsigned int limit = 50;char buf[20];int p[50];unsigned int i;

//buffer overflow!A: scanf("%s", buf);B: for (i=0; i<limit; i++)

printf(" %x ", *(p+i)); }

There are some attacks which do not use tainted pointers

Page 7: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 7

Another ExampleAnother Example

*void leak() {int secret_key;char buf[12];

A: recv(s,buf,12,0);B: printf(buf); //format string!}

*From Chen’ DSN 2005

Page 8: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 8

A New Format String AttackA New Format String Attack

• A typical format string attack– The format string supplies the target address directly– The format string also contains constant widths to specify the

value to be written • The new attack

– Use “*” specifier to get field widths from untainted values in the stack to construct arbitrary untainted values

This new format string attack can write arbitrary untainted values (Dalton’ WDDD 2006), even with arbitrary untainted target addresses

Page 9: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 9

Our Idea: InstructionOur Idea: Instruction--Level Taint CheckingLevel Taint Checking

• Instruction-level -- a generic form of taint checking– Cover more data taint checking than previous ones– Minor changes to the existing taintedness tracking

architectures– Provide a higher degree of security protection

• Taintless-Instruction– An instruction does not deal with tainted data

• Tainted-Instruction– An instruction deals with tainted data

Page 10: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 10

OutlineOutline

• Motivation• Design• Experiments• Applications• Conclusion

Page 11: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 11

Our DesignOur Design

L1-D

Page 12: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 12

InstructionInstruction--Level Taint Checking Level Taint Checking

• Taintless-Instruction Profile collection– Manual annotation– Static analysis– Dynamic training

• Taint checking is carried out in four steps at runtime– Load the collected Taintless-Instruction profile– Tag data from suspicious input channels as tainted– Track taintedness propagation through execution– Raise an alarm when a Taintless-Instruction encounters

some tainted operand

Page 13: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 13

OutlineOutline

• Motivation• Design• Experiments• Applications• Conclusion

Page 14: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 14

Experimental MethodologyExperimental Methodology

• SimpleScalar processor simulator with the PISA instruction set

– Byte-granularity taintedness tracking

– Taint data from I/O system calls such as READ, RECV, etc.

– Bitwise OR of the taintedness bits from source operands• Similar to the rules used in Chen’ DSN 2005

Page 15: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 15

Preliminary Results from SPEC CPU2000Preliminary Results from SPEC CPU2000

0%

10%

20%

30%

40%

50%

60%

70%

80%

90%

100%

bzip2 gcc gzip mcf parser perl twolf vortex vpr

Unexecuted

Tainted-Instruction

Taintless-Instruction

Page 16: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 16

OutlineOutline

• Motivation• Design• Experiments• Applications• Conclusion

Page 17: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 17

Canary Protection Schemes Against Buffer OverflowCanary Protection Schemes Against Buffer Overflow

/* declaration part of local variables */volatile int guard;

/* the entry point */ guard = guard_value;

/* the exit point */if (guard != guard_value) { /* output error log */ /* halt execution */ }

ProPolicehttp://www.trl.ibm.com/projects/security/ssp/

Page 18: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 18

Buffer OverflowBuffer Overflow

void vuln_stack_function_ptr(int choice)

long stack_buffer[BUFSIZE];

void (*stack_function_pointer)(void);. . .

memcpy(stack_buffer, overflow_buffer, overflow+4);

(void)(*stack_function_pointer)();

jal 00404e80 <memcpy>

lw $v0[2],108($sp[29])jalr $ra[31],$v0[2]

volatile unsigned int pad_begin = 0;

volatile unsigned int pad_end = 0;

pad_end++; pad_begin++;

lw $v0[2],32($sp[29])addiu $v0[2],$v0[2],1

lw $v0[2],32($sp[29])sw $v0[2],32($sp[29])

lw $v0[2],104($sp[29])addiu $v0[2],$v0[2],1sw $v0[2],104($sp[29])lw $v0[2],104($sp[29])

Code from the testbed of twenty buffer overflow attacks by John Wilander’ NDSS 2003

Untainted data

Taintless Instructions

Page 19: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 19

ComparisonComparison

• Our improvements

– Fewer number of instructions to be executed

– More secure since the guard values do not have to remain secret

Page 20: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 20

Format StringFormat String

intDEFUN(vfprintf, (s, format, args),register FILE *s AND CONST char

*format AND va_list args){/* Pointer into the format string. */

register CONST char *f;. . .

f = format;

A: while (*f != '\0')

{B: . . .

addu $t0[8],$zero[0],$s0[16]j A

B: . . .. . .

A: lb $v0[2],0($t0[8])lbu $v1[3],0($t0[8])bne $v0[2],$zero[0], B

Mark them as Taintless-Instructions to catch format string

attacks

The Devil enters here

Page 21: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 21

ConclusionConclusion

• A new generic instruction-level taint checking architecture– Minor changes to the existing taintedness tracking

architectures– Minor performance overhead– Compatible with existing ISAs– Provide a higher degree of security protection

Page 22: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 22

Ongoing WorkOngoing Work

• Experiments on real applications– Instruction-Level program taintedness behavior– Collection of Taintless-Instructions profile

• Static analysis• Dynamic training

– Evaluation of taint checking schemes

Page 23: Improving Software Security via Runtime Instruction-Level ... · Improving Software Security via Runtime Instruction-Level Taint Checking Jingfei Kong, Cliff C. Zou and Huiyang Zhou

University of Central Florida 23

Thank you!Thank you!

Questions?Questions?