decoupling dynamic information flow tracking with a

24
Decoupling Dynamic Information Flow Tracking with a Dedicated Coprocessor Hari Kannan, Michael Dalton, Christos Kozyrakis Computer Systems Laboratory Stanford University

Upload: others

Post on 02-May-2022

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Decoupling Dynamic Information Flow Tracking with a

Decoupling Dynamic

Information Flow Tracking

with a Dedicated Coprocessor

Hari Kannan, Michael Dalton, Christos Kozyrakis

Computer Systems Laboratory

Stanford University

Page 2: Decoupling Dynamic Information Flow Tracking with a

Motivation

Dynamic analysis help better understand SW behavior Security, Debugging, Full system profiling

Hardware support for such analyses very useful Provides speed advantage over SW solutions

Systems manage metadata for analysis in hardware

Implementation challenges Storage overheads of metadata (Suh’05)

Processing of metadata

Need fast processing (low overheads)

Need cost effective implementation

Solution: Tightly coupled coprocessor for analysis 2

Page 3: Decoupling Dynamic Information Flow Tracking with a

Case Study – DIFT (Dynamic Information Flow Tracking)

DIFT taints data from untrusted sources

Extra tag bit per word marks if untrusted

Propagate taint during program execution

Operations with tainted data produce tainted results

Check for suspicious uses of tainted data

Tainted code execution

Tainted pointer dereference (code & data)

Tainted SQL command

Can detect both low-level & high-level threats 3

Page 4: Decoupling Dynamic Information Flow Tracking with a

r1:0

r2:idx

r3:&buffer

r4:0

Data T

r5:x

DIFT Example: Memory Corruption

Tainted pointer dereference security trap

int idx = tainted_input;

buffer[idx] = x; // memory corruption

Vulnerable C Code

set r1 &tainted_input

load r2 M[r1]

add r4 r2 + r3

store M[r4] r5 r4:&buffer+idx

r1:&input

r2:idx=input

TRAP

4

Page 5: Decoupling Dynamic Information Flow Tracking with a

HW Option 1: In-core DIFT

Policy Decode

Tag ALU

Tag Check

Decode D-Cache RegFile ALU I-Cache Traps W

B

5

Integrated DIFT hardware [Dalton’07, Suh’04, Chen’05]

No performance, minor power, and minor area overhead

Invasive changes to processor

High design and validation costs

Synchronizes metadata and data per instruction

Page 6: Decoupling Dynamic Information Flow Tracking with a

Core 1

(App)

HW Option 2: Offloading DIFT

Capture

Trace

Log buffer

(L2 cache)

6

Core 2

(DIFT)

Analyze

Trace

SW DIFT on modified multi-core chip (e.g., CMU’s LBA)

Flexible support for various analyses

Large area & power overhead (2nd core, trace compress)

Large performance overhead (DBT, memory traffic)

Significant changes to processor & memory hierarchy

General

Purpose Core

General

Purpose Core

Page 7: Decoupling Dynamic Information Flow Tracking with a

Our Proposal: DIFT Coprocessor

7

Off-core DIFT coprocessor (similar to watchdog processors)

Small performance, power, and area overhead

Minor changes to processor

Reuse across processor designs

L2 Cache

Cache

Main

Core

Tag

Cache

Tag

Core

Instructions

Exceptions

DIFT

Coprocessor

General

Purpose Core

Page 8: Decoupling Dynamic Information Flow Tracking with a

Outline

Motivation & Overview

Software Interface of the coprocessor

Architecture of the coprocessor

Performance & Security Evaluation

Conclusion

8

Page 9: Decoupling Dynamic Information Flow Tracking with a

Coprocessor Setup

A pair of policy registers Accessible via coprocessor instructions

Could also be memory-mapped

Policy granularity: operation type Select input operands to be checked (if tainted)

Select input operands that propagate taint to output

Select the propagation mode (and, or, xor)

ISA instructions decomposed to 1 operations Types: ALU, logical, branch, memory, compare, FP, …

Makes policies independent of ISA packaging

Same HW policies for both RISC & CISC ISAs

9

Page 10: Decoupling Dynamic Information Flow Tracking with a

r1:0

r2:idx

r3:&buffer

r4:0

Data T

r5:x

What happens without Proc/Coproc Synchronization?

int idx = tainted_input;

buffer[idx] = x; // memory corruption

Vulnerable C Code

set r1 &tainted_input

load r2 M[r1]

add r4 r2 + r3

store M[r4] r5 r4:&buffer+idx

r1:&input

r2:idx=input

EXPLOIT

10

exec (sys call)

Attacker executes system call system compromise

SYSTEM

COMPROMISE

Page 11: Decoupling Dynamic Information Flow Tracking with a

System Calls as Sync points

Key Idea: Main core and coproc sync at system calls

Security: This prevents attacker from executing system calls

Application’s corrupted address space can be discarded

Does not weaken the DIFT model

DIFT detects attack only at time of exploit, not corruption

Performance: Synchronization overhead typically tens of cycles

Function of decoupling queue size

Lost in the noise of system call overheads (hundreds of cycles)

11

Page 12: Decoupling Dynamic Information Flow Tracking with a

r1:0

r2:idx

r3:&buffer

r4:0

Data T

r5:x

System Call Synchronization

int idx = tainted_input;

buffer[idx] = x; // memory corruption

Vulnerable C Code

set r1 &tainted_input

load r2 M[r1]

add r4 r2 + r3

store M[r4] r5 r4:&buffer+idx

r1:&input

r2:idx=input

TRAP

12

exec (sys call) STALL

Tainted pointer dereference security exception

Page 13: Decoupling Dynamic Information Flow Tracking with a

Coprocessor Design

DIFT functionality in a coprocessor

4 tag bits of metadata per word of data

Coprocessor Interface (via decoupling queue)

Pass committed instruction information

Instruction encoding could be at micro-op granularity (in x86)

Physical address obviates need for MMU in coprocessor

Processor

Core

I

Cache

D

Cache

Policy Decode

Tag ALU

Tag Check Tag

Cache

Tag RF WB

DIFT Coprocessor PC

Inst Encoding

Physical Address

Security exception

L2 Cache

13

Decoupling

queue Stall

Page 14: Decoupling Dynamic Information Flow Tracking with a

Prototype

Leon-3

@40MHz

512MB

DRAM

Ethernet

AoE

Ethernet

AoE

Leon-3

@65MHz

512MB

DRAM

14

Hardware

Paired with simple SPARC V8 core (Leon-3)

Mapped to FPGA board

Software

Fully-featured Linux 2.6

Design statistics

Clock frequency: same as original

Logic: +7.5% overhead

… of simple in-order core with no speculation

Page 15: Decoupling Dynamic Information Flow Tracking with a

System Performance Overheads

Runtime overhead < 1% over SPEC benchmarks

512 byte tag cache

6-entry decoupling queue 15

0.00%

0.20%

0.40%

0.60%

0.80%

1.00%

gzip gap vpr gcc mcf crafty parser vortex bzip2 twolf

Ru

nti

me O

verh

ead

(%

)

Page 16: Decoupling Dynamic Information Flow Tracking with a

Scaling the tag cache

Worst case micro-benchmark 512-byte tag cache provides good performance

16

0%

5%

10%

15%

20%

25%

16B 32B 64B 128B 256B 512B 1K

Ru

nti

me O

verh

ead

(%

)

Size of the Tag Cache

Queue full stalls

Memory contention Stalls

Queue full Stalls

Page 17: Decoupling Dynamic Information Flow Tracking with a

Scaling the decoupling queue

Worst case micro-benchmark 6 entry queue reduces performance overhead

17

0%

2%

4%

6%

8%

10%

12%

0 2 4 6

Ru

nti

me O

verh

ead

(%

)

Size of the Queue (no. of entries)

Queue fill Stalls

Memory contention Stalls

Queue full Stalls

Page 18: Decoupling Dynamic Information Flow Tracking with a

Coprocessors for complex cores

Modest overheads with higher IPC cores Because main core rarely achieves peak IPC (=1)

Coprocessor performs very simple operations

Implies coprocessor can be paired with complex cores 18

0.9

0.95

1

1.05

1.1

1.15

1.2

1 1.5 2

Rela

tive O

verh

ead

Ratio of main core's clock to coprocessor's clock

gzip

gcc

twolf

Page 19: Decoupling Dynamic Information Flow Tracking with a

Security Policies Overview

19

P Bit T Bit B Bit S Bit

Buffer Overflow

Policy

Identify all pointers,

and track data taint. Check for illegal

tainted ptr use. Y Y

Offset-based

attacks (control ptr)

Track data taint,

and bounds check to validate.

Y

Format String

Policy

Check tainted args

to print commands. Y Y

SQL/XSS Check tainted

commands. Y Y

Red zone Policy Sandbox heap data. Y

Sandboxing Policy Protect the security

handler. Y

Page 20: Decoupling Dynamic Information Flow Tracking with a

Security Experiments

Program Lang. Attack Detected Vulnerability

tar C Directory Traversal Open tainted dir

gzip C Directory Traversal Open tainted dir

Wu-FTPD C Format String Tainted ‘%n’ in vfprintf string

SUS C Format String Tainted ‘%n’ in syslog

quotactl

syscall

C User/kernel pointer

dereference

Tainted pointer to kernelspace

sendmail C Buffer (BSS) Overflow Tainted code ptr

polymorph C Buffer Overflow Tainted code ptr

htdig C++ Cross-site Scripting Tainted <script> tag

Scry PHP Cross-site Scripting Tainted <script> tag

Unmodified SPARC binaries from real-world programs

Basic/net utilities, servers, web apps, search engine

20

Page 21: Decoupling Dynamic Information Flow Tracking with a

Security Experiments

Protection against low-level memory corruptions

Both in userspace and kernelspace 21

Program Lang. Attack Detected Vulnerability

tar C Directory Traversal Open tainted dir

gzip C Directory Traversal Open tainted dir

Wu-FTPD C Format String Tainted ‘%n’ in vfprintf string

SUS C Format String Tainted ‘%n’ in syslog

quotactl

syscall

C User/kernel pointer

dereference

Tainted pointer to kernelspace

sendmail C Buffer (BSS) Overflow Tainted code ptr

polymorph C Buffer Overflow Tainted code ptr

htdig C++ Cross-site Scripting Tainted <script> tag

Scry PHP Cross-site Scripting Tainted <script> tag

Page 22: Decoupling Dynamic Information Flow Tracking with a

Security Experiments

Protection against semantic vulnerabilities

22

Program Lang. Attack Detected Vulnerability

tar C Directory Traversal Open tainted dir

gzip C Directory Traversal Open tainted dir

Wu-FTPD C Format String Tainted ‘%n’ in vfprintf string

SUS C Format String Tainted ‘%n’ in syslog

quotactl

syscall

C User/kernel pointer

dereference

Tainted pointer to kernelspace

sendmail C Buffer (BSS) Overflow Tainted code ptr

polymorph C Buffer Overflow Tainted code ptr

htdig C++ Cross-site Scripting Tainted <script> tag

Scry PHP Cross-site Scripting Tainted <script> tag

Page 23: Decoupling Dynamic Information Flow Tracking with a

Security Experiments

Protection is independent of programming language

Propagation & checks at the level of basic ops 23

Program Lang. Attack Detected Vulnerability

tar C Directory Traversal Open tainted dir

gzip C Directory Traversal Open tainted dir

Wu-FTPD C Format String Tainted ‘%n’ in vfprintf string

SUS C Format String Tainted ‘%n’ in syslog

quotactl

syscall

C User/kernel pointer

dereference

Tainted pointer to kernelspace

sendmail C Buffer (BSS) Overflow Tainted code ptr

polymorph C Buffer Overflow Tainted code ptr

htdig C++ Cross-site Scripting Tainted <script> tag

Scry PHP Cross-site Scripting Tainted <script> tag

Page 24: Decoupling Dynamic Information Flow Tracking with a

Conclusions

Hardware dynamic analyses aid program understanding

Decoupling analyses from main core essential for practicality

Proposed a tightly coupled coprocessor for DIFT

Does not compromise security model

Has low performance and area overheads

Full-system FPGA prototype Reliably catches exploits in user & kernel-space

24