summer school on real-world crypto and privacy - why your … · 2017-06-14 · server app...

58
Why Your Encrypted Database Is Not Secure Paul Grubbs Tom Ristenpart Vitaly Shmatikov

Upload: others

Post on 15-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Why Your EncryptedDatabase Is Not

Secure

Paul Grubbs Tom RistenpartVitaly Shmatikov

Page 2: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Outsourced Applications Today

datadataServer

Page 3: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Encrypt

the data!

Page 4: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Server

App functionality nolonger works :(

App functionality nolonger works :(

Encrypted

dataEncrypted

data

Encrypt the Data

Page 5: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

use property-revealingencryption (PRE)

ServerEncrypted

dataEncrypted

data

• Searchable encryption• Deterministic encryption• Order-revealing encryption

Encrypt the Data

Page 6: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Building “Secure” Systems

Encrypted

dataEncrypted

data

ServerServer

Page 7: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

ServerServer

Building “Secure” Systems

“computing on encrypted data”

Page 8: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Building “Secure” Systems

• CryptDB (SOSP 2011)• Mylar (NSDI 2014)• Seabed (OSDI 2016)• Arx • Many others• Lots of industry and

government interest!!

• CryptDB (SOSP 2011)• Mylar (NSDI 2014)• Seabed (OSDI 2016)• Arx • Many others• Lots of industry and

government interest!!

Page 9: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

What They Claim

Page 10: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

“Magically Flexible Cryptography”

Page 11: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Claims

emulates fully homomorphic encryptionemulates fully homomorphic encryption

provable confidentialityprovable confidentiality

semantic securitysemantic security

the database does not leak the valuesof sensitive fields, even if the attackerhas side information

the database does not leak the valuesof sensitive fields, even if the attackerhas side information

Page 12: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Fallacy #1

Encryption scheme is “secure”

does not mean

The system is “secure”

Page 13: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

What This Talk Is About

Encrypteddata

EncrypteddataHow to take a plausible

encryption scheme

… and build a completelyinsecure system from it

Page 14: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Unsafe at Any Speed

• CryptDB (SOSP 2011)• Mylar (NSDI 2014)• Seabed (OSDI 2016)• Arx • Many others• Lots of industry and

government interest!!

• CryptDB (SOSP 2011)• Mylar (NSDI 2014)• Seabed (OSDI 2016)• Arx • Many others• Lots of industry and

government interest!!… insecure under ANY real-world attack

If you look at an actualcommodity DBMS …

Page 15: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security
Page 16: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

ServerEncrypted

dataEncrypted

data

Threat Models

Active

Persistent passive

“Snapshot”

Page 17: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

• Secure against active attacks: false– Grubbs et al. “Breaking web applications built on top

of encrypted data” (CCS 2016)

• Secure against “snapshot” attacks: false– Grubbs et al. “Why your encrypted database is not

secure” (HotOS 2017)

• Sensitivity analysis helps: false– Bindschaedler et al. “The tao of inference in privacy-

protected databases” (forthcoming)

Claims Meet Reality

Page 18: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Security Against Active Attacks

Page 19: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Mylar

My secretdiary

Hiring plan for 2017Add orange user

( )

Insecure proxy re-encryption scheme[see Van Rompay et al. 2017]

Server, you can convert allmy searches to blue key.Here’s a token to do it.

Server, you can convert allmy searches to blue key.Here’s a token to do it.

I trustblue user

I trustblue user

Page 20: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Mylar Under Active Attack

Hiring plan for 2017

Search(w)

My secretdiary

( )

Page 21: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

some user machines … collude withthe server… because theadversary broke into a user’smachine

some user machines … collude withthe server… because theadversary broke into a user’smachine

Page 22: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Mylar Under Active Attack

Hiring plan for 2017

Search(w)

My secretdiary

( )

Search(w) ( ) ++ = H(w)

Unkeyed “hash” of keyword.Perform dictionary attack.Unkeyed “hash” of keyword.Perform dictionary attack.

Page 23: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

… as long as none of theusers with access to thatdata item use acompromised machine

… as long as none of theusers with access to thatdata item use acompromised machine

Page 24: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Mylar Under Active Attack

Hiring plan for 2017

Search(w)

My secretdiary

None of the users withaccess to this data item usea compromised machine

None of the users withaccess to this data item usea compromised machine

Page 25: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Mylar in a Hospital

One nurse loses their laptop,server can compromise everydoctor’s private files

One nurse loses their laptop,server can compromise everydoctor’s private files

Page 26: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

… assuming there are noqueries in the snapshot

“Snapshot” Threat Model

Server

Existing systems explicitly claim security

False in any realisticsnapshot attack on acommodity DBMS

Page 27: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

A Simple System Abstraction

DB

OSVolatile memory

Persistentstorage

Page 28: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Actual Attacks

DB

OSVolatile memory

Persistentstorage

SQL injection

Full-system compromise

Disk theft

VMsnapshotleak

Page 29: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Case Study: MySQL similar issues in any other commodity DBMS

Attack What MySQL leaksFailed encrypted

database

Disk theftMVCC datastructures

Arx’s range queryindex

SQL Injection Past query statisticsSeabed’s SPLASHE

scheme

Full systemcompromise or VM

snapshot leakText of past queries

CryptDB, Lewi/Wu,etc.

Page 30: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Disk Theft

If this is your threatmodel, just use full-diskencryption

Page 31: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Logs on Disk

Insert

Select

Update->

Up

Multi-version concurrency controlusing log data structures

In

General query log (not widely used)

Binary log records modifications, used for replication and recovery

MVCC log

Data modification queriescan be reconstructed fromthese logs [FHMW ’10, FKSHW ’12]

In all modern SQL databases!

Page 32: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Arx

Ek(1)

Ek(5)

Ek(2)

Ek(3) Ek(7)

>=2 >=2

>=2

>=2

I used up these nodes

Here, refresh nodeswith these ciphertexts

Ek(5)

Ek(2)Ek(3)

Range queries via chained garbled circuitsTree nodes become consumed, need replacing

Poddar et al.

Page 33: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Security Claim for Arx

“Arx protects the database with thesame level of security as regular

AES-based encryption”

“Arx protects the database with thesame level of security as regular

AES-based encryption”

Poddar et al.

Page 34: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Arx Under Snapshot Attack

Range queries via chained garbled circuitsTree nodes become consumed, need replacing

Up

Ek(3)

Up

Ek(5)

Up

Ek(2)

Ek(1)

Ek(5)

Ek(2)

Ek(3) Ek(7)

Ek(2)

Ek(3)

Ek(5)

Here, refresh nodeswith these ciphertexts

Ek(5)

Ek(2)Ek(3)

Consumed nodes immediately replaced,stored in MVCC log

Query access pattern recorded on disk

Snapshot attacker can recover queriesand plaintexts using variants of attacksfrom [GSBNR - S&P ‘17]

Page 35: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

SQL Injection

Attack What MySQL leaksFailed encrypted

database

Disk theftMVCC datastructures

Arx’s range queryindex

SQL Injection Past query statisticsSeabed’s SPLASHE

scheme

Full systemcompromise or VM

snapshot leakText of past queries

CryptDB, Lewi/Wu,etc.

Page 36: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

SQL Injection

Malicious code

Runs here

SQL injection accounted for 51% of all Webapplication attacks in 2016 (source: Akamai)

Page 37: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Diagnostic Tables

Insert

Select

performance_schema

performance_schema stores current query for all threads,statistics for past queries

Inserts:Selects:

Insert

112

Separate counts for querieswhich involve different columns

information_schema stores current query for all users,contents of buffer cache

Page 38: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Problem: Frequency AnalysisName Has given this

talk before

Paul Grubbs 1

Thomas Ristenpart 0

Vitaly Shmatikov 0

Order-preserving encryption reveals histogram of plaintext values

This is how Naveed et al. used frequency analysis to break CryptDB: match histogram to auxiliarymodel of data distribution

Page 39: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

SeabedName Has given this

talk before

Paul Grubbs 1

Thomas Ristenpart 0

Vitaly Shmatikov 0

Each possible plaintext getsits own column

Name C2 C3

aspoiwnpoinio Ek(1) Ek(0)

petryoiueytiew Ek(0) Ek(1)

Xncmxncmbcn Ek(0) Ek(1)

(“Has …”=1) (“Has …”=0)

SELECT Count(“Has … ”) WHERE “Has …”=1 SELECT Count(C2)

Separate counts for queries which involve different columns

WHERE clause transformed to correct column

Papadimitriou et al. (OSDI 2016)

Page 40: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Example

Page 41: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

SQLi Extracts Diagnostic Tables

SELECT Count(C3)

SELECT Count(C2)

SELECT Count(C3)

performance_schema:

Selects for C2:Selects for C3:

12

Separate counts for queries which involve different columns

Use frequency analysisto recover plaintexts(see paper for details)

Page 42: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Full-System Snapshot

Attack What MySQL leaksFailed encrypted

database

Disk theftMVCC datastructures

Arx’s range queryindex

SQL Injection Past query statisticsSeabed’s SPLASHE

scheme

Full systemcompromise or VM

snapshot leakText of past queries

CryptDB, Lewi/Wu,etc.

Page 43: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Full-System CompromiseLeakage of sensitive data atOS level is well-studied [CPGR, DLJKSXSW]

We focus on DBMSaddress space, thingsinaccessible to users

Page 44: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Data Structures and CachesAdaptive hash index tracks pages accesses, indexes automaticallyMySQL query cache stores select queries and resultsOther query caches (memcached)

MySQL manages internal heaps, does not zero freed memory!

Insert

Select

Select

essential for performance!

Page 45: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Token-Based Systems

Select

Still there.

Still there.

Still there.

Still there.

CryptDB, Mylar, Lewi-Wu, other searchable encryption schemescannot be semantically secure ifattacker sees a single search token

Searchtoken

100,000 morerandom selects…

1,000 random selects…

Waited a while…

Searchtoken

Page 46: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Let Me Make Myself Perfectly Clear

These encrypted databases CANNOT besemantically secure under ANY real-world attack

Page 47: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security
Page 48: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

“I Will Build My Own Database”

You can try…

Transaction logs needed to support ACIDLog-structured storageCachingAdaptive data structures adjust to workload

… everything in modern databases leaksinformation about past queries

Page 49: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Sensitivity Analysis

“strong” encryption

deterministicencryption

order-preservingencryption

can check for equalitycan sort

Page 50: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Auxiliary Data

IND-CPAOPEDET

Public auxiliary data(e.g., previous release of similar datasets)

Distributionof values ineach column

Correlations betweencolumns

Page 51: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Bayesian Inference

OPEDET

Public auxiliary data(e.g., previous release of similar dataset)

Distributionof values ineach column

Distribution ofciphertexts ineach column

Page 52: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

slide 52

Observedciphertexts

Plaintext distribution(from auxiliary data)

Most likely mapping ofciphertexts to plaintexts

Density of multinomial distribution

Multinomial AttackBindschaedler et al.

Page 53: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

• Optimal– Maximum likelihood estimator for deterministic ORE

• Outperforms previous heuristics– Naveed et al. frequency analysis (CCS 2015)– Grubbs et al. non-crossing attacks (Oakland 2017)

• Extends to multiple columns– Condition distribution on previously recovered

plaintexts for a dependent column

Multinomial AttackBindschaedler et al.

Page 54: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Inferring “Sensitive” Columns

IND-CPAOPEDET

Public auxiliary data(e.g., previous release of similar dataset)

Distributionof values ineach column

Correlations betweencolumns

Features Prediction

Bindschaedler et al.

Multinomial attack!

Page 55: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Let’s Try with Real Data

• Over 7 million hospital dischargerecords each year

• Demographic + medical attributes

• Over 3 million records each year• Demographic attributes, income

• Data dump from 2015 hack• Names and addresses of over

600,000 police officers

Page 56: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

• HCUP-NIS hospital discharge records– Infer if patient has a mental health or substance

abuse condition with 97% accuracy– … mood disorder with 96% accuracy

• U.S. Census American Community survey– Recover 90% of PRE-encrypted attributes– Infer income to within $8.4K

• Fraternal Order of Police (FOP) data dump– Exact home addresses of 5,500 police officers in PA

Empirical Results

Page 57: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Remember

Encryption scheme is “secure”

does not mean

The system is “secure”

Page 58: Summer School on Real-World Crypto and Privacy - Why Your … · 2017-06-14 · Server App functionality no longer works :( Encrypted data Encrypt the Data. use ... semantic security

Advice to Practitioners