never been kist: tor’s congestion management blossoms with ... · never been kist: tor’s...

65
Never Been KIST: Tor’s Congestion Management Blossoms with Kernel- Informed Socket Transport 23 rd USENIX Security Symposium August 20 th 2014 Rob Jansen US Naval Research Laboratory John Geddes University of Minnesota Chris Wacek Georgetown University Micah Sherr Georgetown University Paul Syverson US Naval Research Laboratory

Upload: hanga

Post on 16-Aug-2019

221 views

Category:

Documents


0 download

TRANSCRIPT

Never Been KIST: Tor’s Congestion Management Blossoms with Kernel-Informed Socket Transport

23rd USENIX Security Symposium August 20th 2014

Rob Jansen US Naval Research Laboratory John Geddes University of Minnesota Chris Wacek Georgetown University Micah Sherr Georgetown University Paul Syverson US Naval Research Laboratory

Anonymous Communication: Tor

Tor is Slow!!! Research* ●  PCTCP: Per-Circuit TCP-over-IPsec Transport for Anonymous Communication

Overlay Networks (CCS ‘13)

●  Reducing Latency in Tor Circuits with Unordered Delivery (FOCI ‘13)

●  How Low Can You Go: Balancing Performance with Anonymity in Tor (PETS ‘13)

●  The Path Less Travelled: Overcoming Tor's Bottlenecks with Traffic Splitting (PETS ’13)

●  An Empirical Evaluation of Relay Selection in Tor (NDSS ‘13)

●  LIRA: Lightweight Incentivized Routing for Anonymity (NDSS ‘13)

●  Improving Performance and Anonymity in the Tor Network (IPCCC ‘12)

●  Enhancing Tor's Performance using Real-time Traffic Classification (CCS ’12)

●  Torchestra: Reducing interactive traffic delays over Tor (WPES ‘12)

●  Throttling Tor Bandwidth Parasites (USENIX Sec ‘12)

●  LASTor: A Low-Latency AS-Aware Tor Client (Oakland ‘12)

●  Congestion-aware Path Selection for Tor (FC ‘12) *Not a comprehensive list

Tor is Slow!!! Research*

*Not a comprehensive list

Where?

This Talk

●  Where is Tor slow? –  Measure public Tor and private Shadow-Tor networks –  Identify circuit scheduling and socket flushing problems

●  Design KIST: Kernel-Informed Socket Transport –  Use TCP snd_cwnd to limit socket writes

●  Evaluate KIST Performance and Security –  Reduces kernel and end-to-end circuit congestion –  Throughput attacks unaffected, speeds up latency attacks

Outline

●  Background

●  Instrument Tor, measure congestion

●  Analyze causes of congestion

●  Design and evaluate KIST –  Performance –  Security

Relay Overview

Relay Overview

TCP

TCP

TCP

TCP

TCP

TCP

TCP

Tor circuits are multiplexed over a

TCP transport

Relay Overview

TCP

TCP

TCP

TCP

TCP

TCP TCP

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Opportunities for traffic

management

Outline

●  Background

●  Instrument Tor, measure congestion

●  Analyze causes of congestion

●  Design and evaluate KIST –  Performance –  Security

Live Tor Congestion - libkqtime Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Live Tor Congestion - libkqtime Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

tag match tag match

Live Tor Congestion - libkqtime Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

tag match tag match track cells

Shadow Network Simulation

●  Enhanced Shadow with several missing TCP algorithms

–  CUBIC congestion control –  Retransmission timers –  Selective acknowledgements (SACK) –  Forward acknowledgements (FACK) –  Fast retransmit/recovery

●  Designed largest known private Tor network –  3600 relays and 12000 simultaneously active clients –  Internet topology graph: ~700k nodes and 1.3m links

Track the UID

Shadow-Tor Congestion – UIDs UID

UID Track the UID

Track the UID

Shadow-Tor Congestion – UIDs UID

UID Track the UID

Kernel Input Kernel Output Tor Input

Tor Output

Tor Circuits

Tor and Shadow-Tor Congestion

10�1 100 101 102 103 104

Time (ms)

0.0

0.2

0.4

0.6

0.8

1.0

Cum

ulat

ive

Frac

tion

kernel in

tor

kernel out

10�1 100 101 102 103

Time (ms)

0.5

0.6

0.7

0.8

0.9

1.0

Cum

ulat

ive

Frac

tion

kernel in

tor

kernel out

Congestion occurs almost exclusively in outbound kernel buffers

Shadow-Tor Live-Tor

Outline

●  Background

●  Instrument Tor, measure congestion

●  Analyze causes of congestion

●  Design and evaluate KIST –  Performance –  Security

Analyzing Causes of Congestion

Kernel Output Tor Output Tor Circuits

Queuing delays in kernel output buffer

Analyzing Causes of Congestion

Kernel Output Tor Output Tor Circuits

Queuing delays in kernel output buffer

Problem 1: Circuit scheduling

Problem 2: Flushing to Sockets

Problem 1: Circuit Scheduling

Kernel Output Tor Output Tor Circuits

Libevent schedules one connection at a time

Problem 1: Circuit Scheduling

Kernel Output Tor Output Tor Circuits

Libevent schedules one connection at a time

Tor only considers a subset of writable

circuits

Problem 1: Circuit Scheduling

Kernel Output Tor Output Tor Circuits

Libevent schedules one connection at a time

Tor only considers a subset of writable

circuits

Circuits from different connections are not prioritized correctly

Problem 1: Circuit Scheduling

Problem 1: Circuit Scheduling

0.0 0.2 0.4 0.6 0.8 1.0Throughput (KiB/s)

0.0

0.2

0.4

0.6

0.8

1.0

Cum

ulat

ive

Frac

tion

160 180 200 220 2400.00.20.40.60.81.0

DE

TER

pri+

rr

pri-

0.00.20.40.60.81.0

Shadow

0.0 0.2 0.4 0.6 0.8 1.0Throughput (KiB/s)

0.0

0.2

0.4

0.6

0.8

1.0

Cum

ulat

ive

Frac

tion

40 60 80 100 120 140 1600.00.20.40.60.81.0

DE

TER

pri+

rr

pri-

0.00.20.40.60.81.0

Shadow

Correctly differentiated No differentiation

Problem 1: Circuit Scheduling

0.0 0.2 0.4 0.6 0.8 1.0Throughput (KiB/s)

0.0

0.2

0.4

0.6

0.8

1.0

Cum

ulat

ive

Frac

tion

160 180 200 220 2400.00.20.40.60.81.0

DE

TER

pri+

rr

pri-

0.00.20.40.60.81.0

Shadow

0.0 0.2 0.4 0.6 0.8 1.0Throughput (KiB/s)

0.0

0.2

0.4

0.6

0.8

1.0

Cum

ulat

ive

Frac

tion

40 60 80 100 120 140 1600.00.20.40.60.81.0

DE

TER

pri+

rr

pri-

0.00.20.40.60.81.0

Shadow

Correctly differentiated No differentiation

99.775% of any two circuits are unshared

Problem 2: Flushing to Sockets

Kernel Output Tor Output Tor Circuits

Queuing delays in kernel output buffer

FIFO

Problem 2: Flushing to Sockets

Kernel Output Tor Output Tor Circuits

Worse priority traffic (high throughput flows) FIFO

Problem 2: Flushing to Sockets

Kernel Output Tor Output Tor Circuits

Better priority traffic (low throughput flows)

Worse priority traffic (high throughput flows) FIFO

Problem 2: Flushing to Sockets

Kernel Output Tor Output Tor Circuits

Better priority traffic (low throughput flows)

Must wait for kernel to flush socket to network (blocked

on TCP cwnd)

Worse priority traffic (high throughput flows) FIFO

Problem 2: Flushing to Sockets

Kernel Output Tor Output Tor Circuits

Better priority traffic (low throughput flows)

Reduces effectiveness of circuit priority

Worse priority traffic (high throughput flows) FIFO

Outline

●  Background

●  Instrument Tor, measure congestion

●  Analyze causes of congestion

●  Design and evaluate KIST –  Performance –  Security

Ask the kernel, stupid!

●  Utilize getsockopt and ioctl syscalls

socket_space = sndbufcap – sndbuflen

tcp_space = (cwnd – unacked) * mss

sndbuflen

sndbufcap

unacked

cwnd

Kernel-Informed Socket Transport

●  Don’t write it if the kernel can’t send it; bound kernel writes by:

–  Socket: min(socket_space, tcp_space) –  Global: upstream bandwidth capacity

Solution to Problem 2

Kernel-Informed Socket Transport

●  Don’t write it if the kernel can’t send it; bound kernel writes by:

–  Socket: min(socket_space, tcp_space) –  Global: upstream bandwidth capacity

●  Choose globally from all writable circuits

Solution to Problem 1

Kernel-Informed Socket Transport

●  Don’t write it if the kernel can’t send it; bound kernel writes by:

–  Socket: min(socket_space, tcp_space) –  Global: upstream bandwidth capacity

●  Choose globally from all writable circuits

●  Try to write again before kernel starvation

KIST Reduces Kernel Congestion

10�1 100 101 102 103

Time (ms)

0.0

0.2

0.4

0.6

0.8

1.0C

umul

ativ

eFr

actio

n

vanilla

global

KIST

KIST Increases Tor Congestion

10�1 100 101 102 103

Time (ms)

0.0

0.2

0.4

0.6

0.8

1.0C

umul

ativ

eFr

actio

n

vanilla

global

KIST

KIST Reduces Circuit Congestion

0 500 1000 1500 2000Time (ms)

0.2

0.3

0.4

0.5

0.6

0.7

0.8C

umul

ativ

eFr

actio

n

vanilla

global

KIST

KIST Improves Network Latency

0.0 0.5 1.0 1.5 2.0 2.5 3.0Time to First Byte (s)

0.0

0.2

0.4

0.6

0.8

1.0C

umul

ativ

eFr

actio

n

vanilla

global

KIST

0.5 1 2 4 80.4

0.6

0.8

1.0

Outline

●  Background

●  Instrument Tor, measure congestion

●  Analyze causes of congestion

●  Design and evaluate KIST –  Performance –  Security

Traffic Correlation: Latency

Hopper et.al. CCS’07

Goal: narrow down potential locations of the client on a target circuit

Traffic Correlation: Latency

Hopper et.al. CCS’07

-Inject redirect or javascript -Start timer

Traffic Correlation: Latency

GET

Hopper et.al. CCS’07

Request redirected page or embedded object

Traffic Correlation: Latency

GET

Hopper et.al. CCS’07

-Stop timer -Estimate latency

Latency Attack | estimate – actual |

0 50 100 150 200 250Difference (ms)

0.0

0.2

0.4

0.6

0.8

1.0C

umul

ativ

eFr

actio

n

vanilla

KIST

Latency Attack num pings until best estimate

0 500 1000 1500 2000Cumulative Number of Pings

0.0

0.2

0.4

0.6

0.8

1.0C

umul

ativ

eFr

actio

n

vanilla

KIST

Traffic Correlation: Throughput

Mittal et.al. CCS’11

Goal: find guard relay of the client on a target circuit

Traffic Correlation: Throughput

Mittal et.al. CCS’11

Probe throughput of all guard relays

Traffic Correlation: Throughput

Mittal et.al. CCS’11

Correlate throughput between

exit and probes

Throughput Attack Results

�0.4�0.3�0.2�0.10.0 0.1 0.2 0.3 0.4 0.5Correlation Score

0.0

0.2

0.4

0.6

0.8

1.0C

umul

ativ

eFr

actio

n

vanilla

KIST

Conclusion

●  Where is Tor slow?

●  KIST complements other performance enhancements, e.g. circuit priority

●  Next steps –  Currently exploring various algorithmic optimizations –  Test KIST in the wild and deploy in Tor

Questions?

[email protected] robgjansen.com

github.com/robgjansen/libkqtime github.com/shadow

think like an adversary

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Network Input

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Split data into socket buffers

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Read data from sockets into Tor

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Process data (encrypt/decrypt)

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Split cells into circuit queues

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Circuits linked to outgoing connection

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Schedule cells

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Write data from Tor into sockets

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Schedule data for sending

Relay Internals Kernel Input Kernel Output Tor Input Tor Output

Tor Circuits

Opportunities for traffic

management

KIST Improves Network Throughput

650 700 750 800 850 900 950Throughput (MiB/s)

0.0

0.2

0.4

0.6

0.8

1.0C

umul

ativ

eFr

actio

n

vanilla

global

KIST