In this post, I'll summarize three fantastic talks from what was one of my favourite sessions of the ACM CCS Conference last month (session 11B: "Attacks using a little leakage").
The setting common to the three papers is a client-server set-up, where the client outsources the storage of its documents or data to a server that's not entirely trusted.
Instead of using the server just for storage, the client wants to outsource some computations on this data too—keyword searches or database queries, for example.
The problem is to find the right cryptographic algorithms that allow efficiently making these searches and queries while minimizing the information leaked from communication between the client and server, or from the server's computations.

**Generic Attacks on Secure Outsourced Databases** (paper, talk)

Georgios Kellaris (Harvard University), George Kollios (Boston University), Kobbi Nissim (Ben-Gurion University) and Adam O'Neill (Georgetown University)
**The Shadow Nemesis: Inference Attacks on Efficiently Deployable, Efficiently Searchable Encryption** (paper, talk)

David Pouliot and Charles V. Wright (Portland State University)
**Breaking Web Applications Built On Top of Encrypted Data** (paper, talk)

Paul Grubbs (Cornell University), Richard McPherson (University of Texas, Austin), Muhammed Naveed (University of Southern California), Thomas Ristenpart and Vitaly Shmatikov (Cornell Tech)

### 1. Generic Attacks on Secure Outsourced Databases

This paper presents two attacks, one exploiting communication volume, and one exploiting the access pattern. "Generic" means that they apply to any kind of encryption, not necessarily deterministic, or order-preserving, or even property-preserving.

Setting |
outsourced relational database (collection of records, where each record has some number of attributes) |

Adversary's goal |
reconstruction of the attribute values for all records |

Model |
database system is static (read-only; queries don't modify records), atomic (each record is encrypted separately), non-storage-inflating (no dummy records), and has records of a fixed length |

Assumptions about data |
attribute values are ordered (say, numerically or alphabetically) |

Assumptions about queries |
uniform range/interval queries (for an attribute with $N$ possible values, there are $\binom{N}{2}+N$ possible queries) |

Adversary's knowledge |
set of possible attribute values |

Adversary's capabilities |
passive, observe queries and either access pattern (which encrypted records are returned) or communication volume (how many encrypted records are returned) |

The big (possibly unreasonable) assumption is that the range queries must be uniform.
However, as the authors point out, the attack model is otherwise weak and the security of an outsourced database shouldn't depend on the query distribution.

#### Attack using access pattern leakage

The adversary observes at least $N^2\cdot \log(N)$ queries, so with high probability, all of the $\binom{N}{2} + N$ queries have occurred (proof: ask a coupon collector).
For each query, it sees which encrypted records were returned.
Suppose the database has $n$ records, and assign a binary indicator vector $\vec{v} \in \{0,1\}^n$ to each query.
A 1 in position $i$ means that the $i$th encrypted record was returned as part of the query results.
The Hamming weight of this vector is the number of matching records.

The attack works as follows.

- Find one of the endpoints. Pick a query that returned all but one of the records (i.e., a query whose associated vector has Hamming weight $n-1$). Let $i_1$ be the index of the 0 in its characteristic vector.
- For $j=2$ to $n$, find a query whose characteristic vector has Hamming weight $j$, with $j-1$ of the 1's in positions $i_1,\ldots,i_{j-1}$. Let $i_j$ be the index of the other 1 in the vector.

This algorithm puts the encrypted records in order, up to reflection, and is enough for the adversary to reconstruct the plaintext!
The paper also describes a reconstruction attack for the case that not all values of the domain occur in the database.
It requires seeing more queries, about $N^4\cdot \log(N)$.

#### Attack using only communication volume

The main idea of this attack is to determine the distance between "adjacent" values.
The adversary observes $q \geq N^4\cdot \log(N)$ queries.
For each query, it sees how many encrypted records were returned.
In the case that not all of the $N$ possible values occur in the database, the attack works as follows.
(It is much simpler when they do.)
Let $r_i$ be the hidden value of record $i$ (i.e., its position in the range 1 to $N$).

- Determine the approximate number of distinct queries that returned a certain number of records.
Let $c_j$ be a count of the number of queries that returned $j$ records, for $0 \leq j \leq n$, so $\sum_{j=0}^n c_j = q$.
Scale all of the $c_j$s by $\frac{N(N+1)}{2}\cdot \frac{1}{q}$.
- Let $d_i = r_{i+1} - r_i$ be the difference in position of the $(i+1)$st record and the $i$th record, for $i=0$ to $n$, when the $n$ records are sorted.
To keep the notation simple, define $d_0 = r_1$ and $d_n = N + 1 - r_n$.
Note that $c_j = \sum_{i=1}^{n+1-j} d_{i-1}\cdot d_{j + i-1}$ for $j=1$ to $n$, and $c_0 = \frac{1}{2} ( \sum_{i=0}^n {d_i}^2 - (N+1) )$.
- Factor a cleverly-constructed polynomial to recover the $d_i$s.
Replace $c_0$ by $2\cdot c_0 + N + 1$.
Let $F(x) = \sum_{i=0}^{n} c_{n-i}\cdot x^{i} + \sum_{i=0}^{n} c_{i}\cdot x^{n+i}$.
Then $F(x)$ factors as $d(x) \cdot d^R(x)$, where $d(x) = \sum_{i=0}^n d_{i}\cdot x^i$ and $d^R(x) = \sum_{i=0}^n d_{n-i}\cdot x^i$.
- Compute the attribute values from the $d_i$s: $r_1 = d_0$ and $r_i = r_{i-1} + d_{i-1}$ for $i=2$ to $n$.

The success of this algorithm depends on $F(x)$ having only 1 factorization into two irreducible polynomials.
Also, since factorization can be slow when there are many records in the database, the authors also tested a simple, brute-force algorithm for checking the $d_i$s and it performed better than factorizing in their experiments.

### 2. The Shadow Nemesis: Inference Attacks on Efficiently Deployable, Efficiently Searchable Encryption

This paper presents attacks on two efficiently deployable, efficiently searchable encryption (EDESE) schemes that support full-text search.
The first scheme they attack is ShadowCrypt, a browser extension that transparently encrypts text fields in web applications without relying on something like client-side JavaScript code.
The second is Mimesis Aegis, a privacy-preserving system for mobile platforms that fits between the application layer and the user layer.

These two EDESE schemes work by appending a list of tags (also called "opaque identifiers") to each message or document, corresponding to the keywords it contains.
You can think of each tag as a PRF with key $k$ applied to the keyword $w$, so $t=PRF_k(w)$.

Setting |
(web) applications that store sets of documents/messages in the cloud and allow keyword search on these documents |

Adversary's goal |
determine which keywords are in a document |

Model |
each document/message has a set of tags corresponding to the keywords it contains |

Assumptions about tags |
the same keyword occurring in multiple documents yields the same tag |

Adversary's knowledge |
auxiliary dataset providing frequency of keywords and keyword co-occurrence statistics |

Adversary's capabilities |
passive, sees encrypted documents/messages and lists of tags |

What I found most interesting about this work was that the problem of determining which keywords are associated with which documents was reduced to problems on graphs!

The **weighted graph matching** problem is the following.
Given two graphs $G=(V_G,E_G)$ and $H=(V_H,E_H)$ on $n$ vertices, each with a set of edge weights $w(E): E \rightarrow \mathbb{R}^{\geq 0}$, determine the mapping $\sigma: V_G \rightarrow V_H$ that makes the graphs most closely resemble each other.
(This type of "matching" is about matching a vertex in one graph to a vertex in another graph; it has nothing to do with maximal independent sets of edges.)
There are a few different possibilities for what it means for the graphs to "most closely resemble each other"—the one used in the paper is minimizing the Euclidean distance of the adjacency matrix of $G$ and the permuted adjacency matrix of $H$.

The **labelled graph matching** problem is just an extension of the weighted graph matching problem where each vertex also has a weight.

The two graphs that will be matched to learn which keywords are in which documents are $G$, whose vertices correspond to the $n$ most frequent keywords in the auxiliary data, and $H$, whose vertices correspond to the $n$ most frequent tags in the target data.
The weight of an edge between 2 vertices is the probability that those two tags (or keywords) occur in the same encrypted document (or document in the auxiliary data set).
To form an instance of the labelled graph matching problem, the vertices are assigned weights that correspond to their frequencies in the target data set or their frequencies in the auxiliary data set.

The authors implemented their weighted graph matching and labelled graph matching attacks on two data sets, based on the 2000-2002 Enron email corpus and the Ubuntu IRC chat logs from 2004-2012.
Their attacks accurately recovered hundreds of the most frequent keywords—see the paper for more details about the results.
And while you're checking it out, read the authors' observation about how critical it is to properly choose Bloom filter parameters when using them to replace the usual inverted index structure in a searchable encryption scheme.

### 3. Breaking Web Applications Built On Top of Encrypted Data

This paper is cheekily titled to reflect the particular system that it attacks—it's from the paper "Building Web Applications on Top of Encrypted Data Using Mylar".
Mylar is an extension to Meteor, a JavaScript web application platform.
The result is a complete client-server system that claims to protect users' data on the way to and at the server.
Mylar's back-end is an instance of MongoDB, a non-relational database where the data is a collection of documents, and each document has a number of key-value pairs.

The main ingredient in Mylar is multi-key searchable encryption (MKSE), which allows users to share data.
The MKSE scheme used in Mylar was built to satisfy two properties: data hiding and token hiding.
One of the results of this paper is proving by counterexample that a scheme that's both data-hiding and token-hiding does not necessarily provide indistinguishable keyword encryptions and keyword tokens.

One of the things I like about this paper is the taxonomy it introduces for real-world adversarial models.
A **snapshot passive** attack is a one-time, well, snapshot of the data stored on a server.
A **persistent passive** attack involves observing all data stored on a server and all operations the server performs during a certain time period.
An **active attack** is one where anything goes—the server can misbehave or even collude with users.

The main part of the paper evaluates the security of a few Mylar apps—one that was already available (kChat, a chat app), and three open-source Meteor apps that were ported to Mylar.
The three apps are MDaisy, a medical appointment app, OpenDNA, an app that analyzes genomic data to identify risk groups, and MeteorShop, an e-commerce app.
Before summarizing some of the paper's results, it's important to understand *principals*, which in Mylar are units of access control and have a name and a key pair.
Every document and every user has a principal, and a principal can also apply to multiple documents.

The paper's main findings are grouped into three categories: exploiting metadata, exploiting access patterns, and active attacks.
First, here are some examples of exploiting metadata in Mylar:

- The
**names of principals**, which are unencrypted to facilitate verifying keys, can leak sensitive information.
For example, in kChat, the names of user principals and chat room principals are simply usernames or email addresses and the chat room name.
- Mylar's
**access graph**, which records the relationships between users, access control levels, and encrypted items, can leak sensitive information. For example, in MDaisy, this access graph could reveal that a particular user (a doctor or other health care professional) regularly creates appointments and shares them with the same other user (a patient). A passive snapshot attacker could combine this leakage with knowledge of the doctor's speciality to infer that a patient is being treated for a certain condition.
- The
**size** of a MongoDB document associated to a user principal can leak sensitive information.
In MDaisy, each user, whether staff or patient, has its own document.
However, staff have only their names stored, while patients have additional information stored, such as date of birth.

Exploiting access patterns of searchable encryption is not new, and Mylar didn't claim to hide them, so I won't say anything further about this.
The active attacks, however, are interesting, because Mylar claimed to protect data against an actively malicious server as long as none of the users who can access it use a compromised machine.
This claim is false, and the paper describes attacks that arise from properties such as the server being able to forcibly add users to a "tainted" principal.
After a user is added to a principal, it automatically computes and sends to the server a "delta" value that adjusts search tokens so documents encrypted with different keys can be searched.
Once the malicious server receives a user's delta value for a tainted principal (whose keys it knows), it can then search for any keyword in any of the user's documents!

These three talks are evidence that we still have a long way to go to get secure, usable encryption that still preserves some functionality, whether in web applications, or outsourced databases or documents. It is hard to get things right. Even then, as the authors of the Shadow Nemesis paper point out, careful tuning of the Bloom Filter parameters thwarts their attacks on Mimesis Aegis, but there's no reason to believe that it's enough to defend against any other attack. I hope that these recent papers will inspire more secure constructions, not only more attacks.

P.S. There was some good discussion about attack vs. defence papers in the CCS panel discussion on the impact of academic security research (video).