voracle - compression oracle attacks on vpn networks · 2018-08-11 · history of attacks vpns and...

83
Compression Oracle Attacks on VPN Networks Nafeez

Upload: others

Post on 27-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Compression Oracle Attacks on VPN

NetworksNafeez

Page 2: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Nafeez

AppSec research, static analysis tools, writing code

Maker @ assetwatch.io - Simple & Transparent Attack Surface Discovery

@sketpic_fx

Page 3: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

OverviewCompression Side Channel and Encryption

History of attacks

VPNs and how they use compression

Voracle attack

How to find if your "VPN" is vulnerable

Way forward

Page 4: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Data CompressionLZ77

Replace redundant patterns

102 CharactersEverything looked dark and bleak, everything looked gloomy,

and everything was under a blanket of mist

89 CharactersEverything looked dark and bleak, (-34,18)gloomy,

and (-54,11)was under a blanket of mist

Page 5: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Data CompressionHuffman Coding

Replace frequent bytes with shorter codes

https://en.wikipedia.org/wiki/Huffman_coding

Page 6: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Data Compression

DEFLATE - LZ77 + Huffman Coding

ZLIB, GZIP are well known DEFLATE libraries

Page 7: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Compression Side Channel

First known research in 2002

Page 8: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

The Side Channel

Length of encrypted payloads

Page 9: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Plain Text Data

Compress

Encrypt

Encrypted Data + Data Length

Page 10: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Plain Text Data

Compress

Encrypt

Add Attacker Controlled Bytes

Encrypted Data + Data Length

Page 11: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Plain Text Data

Compress

Encrypt

Add Attacker Controlled Bytes

Observe Encrypted Traffic

Encrypted Data + Data Length

Page 12: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Compression Oracle Attack

Chosen Plain Text Attack

Brute force the secret byte by byte

Force a compression using the chosen byte and the existing bytes in the secret

Page 13: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=1

Encrypted Length = 30

secret=637193-some-app-data;secret=1

Page 14: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=1

Encrypted Length = 30

secret=637193-some-app-data;secret=1

Application Data

Attacker injected bytes

Whole data before compression /

encryption

Page 15: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=1

Encrypted Length = 30

secret=637193-some-app-data;secret=1Compressible Compressible

Page 16: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=2

Encrypted Length = 30

secret=637193-some-app-data;secret=2

Page 17: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=3

Encrypted Length = 30

secret=637193-some-app-data;secret=3

Page 18: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=4

Encrypted Length = 30

secret=637193-some-app-data;secret=4

Page 19: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=5

Encrypted Length = 30

secret=637193-some-app-data;secret=5

Page 20: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

secret=637193-some-app-data;

Compress

Encrypt

Data Length

secret=6

Encrypted Length = 29

secret=637193-some-app-data;secret=6

More Compression, Smaller Length

Compression increased by 1 byte

Page 21: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

How can we convert this into a real world attack on

browsers?

Page 22: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Plain Text Data

Compress

Encrypt

Add Attacker Controlled Bytes

Observe Encrypted Traffic

Encrypted Data + Data Length

Page 23: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Add Attacker Controlled Bytes

Observe Encrypted Traffic

Ambient authority of Cookies in browsers

Simple cross-domain requests with POST body

MITM. People do this all the time

Page 24: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

EkoParty 2012

Back in 2012Juliano Rizzo, Thai Duong

Page 25: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

CRIME, 2012

www.ekoparty.org/archive/2012/CRIME_ekoparty2012.pdf

Page 26: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

TIME Attack 2013

Tal Be'ery, Amichai Shulman

Timing side channel purely via browsers, using TCP window sizes.

Extending CRIME to HTTP Responses

Page 27: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

BREACH Attack 2013

BreachAttack.com

Angelo Prado, Neal Harris, Yoel Gluck

Page 28: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

So far

CRIME style attacks have been mostly targeted on HTTPS

There are more - HEIST, Practical Developments to BREACH

Page 29: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

So, whats new today?

Page 30: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

VPN Tunnels

Page 31: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

TLS VPNs are pretty common these days

Page 32: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable
Page 33: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

What do most of these SaaS VPNs have in

common?

Page 34: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

OpenVPN

Page 35: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

High level overview

Authentication & Key Negotiation (Control Channel)

Data Channel Compression

Data Channel Encryption

Page 36: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Compress everything

UDP

TCP

Bi-Directional

Page 37: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

OpenVPN Compression Algorithms

LZO

LZ4

-LZ77 Family-

Page 38: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

We have a compress then encrypt on all of data channel

Page 39: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

VORACLE Attack

Page 40: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Under a VPN, HTTP WebApps are still

insecure !

Page 41: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Things are safe, if the underlying app layer already uses an encryption channel.

Page 42: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Things might go bad, if the VPN tunnel is helping you encrypt already non-

encrypted data

Page 43: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Lets see how this attack works on an HTTP website using an encrypted VPN

Page 44: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

VPN Server and Client has compression enabled

Requirements

Attacker can observe VPN traffic

VPN User visits attacker.com

Page 45: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Page 46: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

Page 47: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Page 48: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Page 49: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Page 50: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Attacker

Page 51: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Attackerattacker.com

Page 52: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Attackerattacker.com

Passive MITM

Page 53: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Attackerattacker.com

Passive MITM

Injected Ads,Malicous Blogs,

etc.

Page 54: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Attackerattacker.com

Passive MITM

Injected Ads,Malicous Blogs,

etc.

Can Observe VPN Data packet Lengths

Page 55: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Setup

VPN User

Browser

HTTP WebApp

Trusted VPN with Compression

Attackerattacker.com

Passive MITM

Injected Ads,Malicous Blogs,

etc.

Can Observe VPN Data packet Lengths

Can Send Cross Domain requests to the HTTP WebApp

Page 56: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attacker can now conduct Compression Oracle attacks on HTTP requests and responses

Page 57: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

https://github.com/OpenVPN/openvpn3

Browser

VPN Client

VPN Server OpenVPN Server

WebApp http://insecure.skepticfx.com

Mozilla Firefox

Steal sessionId cookie from a cross-domain websiteAttack Goal

Demo

Page 58: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Voracle

https://github.com/skepticfx/voracle

Page 59: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Attack Challenges

No Server Name Indication(SNI) or TLS certificates.

VPN traffic is too chatty. Everything goes through it

Hard to determine attacker's own traffic

Page 60: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Browser needs to send HTTP requests in single TCP Data Packet

Also

Page 61: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Google Chrome splits Plain HTTP requests into Header and Body

So we can't get the compression window in the same request

Page 62: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Mozilla Firefox sends them all in a single TCP data packet

Now we get the compression window in the same request

Page 63: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Detecting Voracle in your VPN

Page 64: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

If your VPN provider is using OpenVPN - take a look at your client configuration.

Page 65: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

OpenVPN Client Configuration (*.OVPN)

Page 66: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Or you can test this dynamically by triggering compression and observing the

length

Page 67: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

DIY Voracle Detection

Fire up Wireshark

Connect to your VPN under test

Send a few Curl requests with compression

Observe VPN Payload Length

Page 68: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

curl -s -o /dev/null -X POST http://website.com -d "--some-data-- Secret=37346282; --blah-- Secret=1 Secret=1"

Length = x

Curl and Observe Length

Page 69: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

curl -s -o /dev/null -X POST http://website.com -d "--some-data-- Secret=37346282; --blah-- Secret=2 Secret=2"

Length = x

Curl and Observe Length

Page 70: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

curl -s -o /dev/null -X POST http://website.com -d "--some-data-- Secret=37346282; --blah-- Secret=3 Secret=3"

Length = x-1

Curl and Observe Length

More Compression, Smaller Length

Page 71: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Fix?

Page 72: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Fixing Compression is an interesting problem

Page 73: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Remember when SPDY was vulnerable to

CRIME?

Page 74: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

HPACK in HTTP/2 selectively disables header compression for sensitive

fields

Page 75: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

https://http2.github.io/http2-spec/compression.html

Page 76: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

cf-nocompress

https://blog.cloudflare.com/a-solution-to-compression-oracles-on-the-web/

Page 77: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

For VPNs, Disable compression entirely for all plain text transactions

Page 78: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Turning compression off by default is

opinionated

Page 79: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

OpenVPN chose to warn the implementors more explicitly to turn off data Compression.

https://github.com/OpenVPN/openvpn/commit/a59fd147

Page 80: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

turned off compression entirely

Page 81: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Its time, everything moves to HTTPS

Page 82: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Takeaway

EndUsers & Website owners - If you are using VPN to access plain text websites over the internet, its time to move them to HTTPs.

VPN Providers - Explicitly state what your VPN protects against. If you are claiming your VPN tunnel protects against plain text web apps, ensure you do not compress them.

Page 83: Voracle - Compression Oracle Attacks on VPN Networks · 2018-08-11 · History of attacks VPNs and how they use compression Voracle attack How to find if your "VPN" is vulnerable

Thank you!

@skeptic_fx

[email protected]