EncDBDB: Searchable Encrypted, Fast, Compressed, In-Memory Database Using Enclaves

Benny Fuhry, Jayanth Jain H. A, Florian Kerschbaum

TL;DR

EncDBDB is a high-performance, encrypted in-memory database that leverages Intel SGX enclaves to perform range queries on compressed data. By moving only the "dictionary" search into a tiny, 1129-line enclave, it achieves sub-millisecond overhead and provides nine different security-performance tradeoffs while actually requiring less storage than some plaintext formats.

What Problem Does This Paper Address?

As companies move sensitive data warehouses to the cloud (Database-as-a-Service or DBaaS), they face a catch-22: they need the cloud's scalability but can't trust the provider with plaintext data.

Existing solutions fall into two camps, both with flaws:

  1. Pure Cryptographic (e.g., Homomorphic Encryption): These are mathematically secure but prohibitively slow for real-world analytics.
  2. TEE-based (e.g., Intel SGX): These use hardware "enclaves" to process data securely. However, previous attempts (like EnclaveDB) tried to shove the entire database engine into the enclave. This creates a massive "Trusted Computing Base" (TCB) of hundreds of thousands of lines of code—increasing the surface area for bugs and side-channel attacks—and hits the strict memory limits of SGX hardware, causing massive performance drops due to memory paging.

EncDBDB asks: Can we build an encrypted database that is fast, compressed, and has a minimal security footprint?

Methods

The authors built EncDBDB on a column-oriented, in-memory architecture integrated with MonetDB. Their "secret sauce" is how they handle Dictionary Encoding.

In dictionary encoding, a column is split into two parts:

  • The Dictionary: A list of unique values.
  • The Attribute Vector: An array of indices (ValueIDs) pointing to the dictionary.

The EncDBDB Innovation: Instead of putting the whole database in the enclave, EncDBDB only puts the Dictionary Search inside. The enclave receives an encrypted range (e.g., "Find all names between 'A' and 'C'"), searches the encrypted dictionary, and returns a list of matching ValueIDs. The "untrusted" host then scans the large Attribute Vector for those IDs. Because the Attribute Vector is just a list of integers, this scan is incredibly fast and can be parallelized outside the enclave.

To give users flexibility, they introduced nine encrypted dictionary types (ED1–ED9) based on two dimensions:

  1. Repetition (Frequency): Does the dictionary reveal how often a value appears? (Revealing, Smoothing via "salting," or Hiding).
  2. Order: Is the dictionary sorted, randomly rotated, or completely unsorted?

Datasets

The researchers evaluated EncDBDB using a snapshot of a real-world SAP customer business warehouse (BW) system.

  • They focused on columns containing up to 10.9 million entries.
  • They specifically tested two extremes: C1 (high cardinality: 6.96M unique values) and C2 (low cardinality: 13,361 unique values).
  • They also used synthetic datasets scaled from 1M to 10M records to test scalability.

Key Insights and Ideas

  • Tiny TCB is Better TCB: The enclave code is only 1,129 lines of C. Compared to the ~235,000 lines in EnclaveDB, this is much easier to audit and verify, significantly reducing the risk of implementation errors.
  • Compression as a Performance Win: Usually, encryption adds overhead. However, because EncDBDB uses dictionary encoding, it can actually be smaller and faster than a plaintext database that doesn't use compression. Integer comparisons on the attribute vector are faster for the CPU than string comparisons.
  • Bypassing the Memory Wall: By only keeping the dictionary in the enclave, EncDBDB avoids the 128MB memory limit of SGX. The bulk of the data (the Attribute Vector) stays in untrusted memory, preventing the "paging" performance death spiral.
  • The Security Spectrum: The nine dictionary types allow a DBA to choose the right tool for the job. If a column is non-sensitive, use ED1 (fastest). If it's highly sensitive, use ED9 (most secure, but slower).

Key Results

  • Sub-millisecond Latency: The computational overhead for range queries is within a millisecond compared to plaintext processing.
  • Minimal Overhead: Across their tests, the average performance overhead was only ~8.9% compared to their own plaintext baseline.
  • Storage Efficiency: For redundant data (like column C2), EncDBDB required significantly less space than a standard plaintext file.
  • Scalability: The system scales linearly with the number of records, and the dictionary search remains logarithmic (O(log |D|)) for most dictionary types.

Limitations and Future Work

  • Complex Joins: The current paper focuses on range queries and basic aggregations (count, sum, avg). Supporting encrypted joins while maintaining this performance is noted as future work.
  • Side-Channel Vulnerabilities: While a smaller TCB makes it easier to implement protections against cache or timing attacks, the paper treats side-channel protection as an "orthogonal problem" and doesn't implement specific mitigations like oblivious RAM (ORAM).
  • Frequency Smoothing Security: The authors admit that the exact security bounds of their "frequency smoothing" (ED4-ED6) algorithm remain an open research question in the cryptography community.
  • Updates (Dynamic Data): While they propose a "delta store" approach for insertions and deletions, the primary performance evaluation was conducted on static datasets.

Summary updated

BibTeX
@inproceedings{fuhry2021encdbdb,
  author = {Benny Fuhry and Jayanth Jain H. A and Florian Kerschbaum},
  title = {{EncDBDB: Searchable Encrypted, Fast, Compressed, In-Memory Database Using Enclaves}},
  booktitle = {DSN},
  year = {2021},
  url = {https://openreview.net/forum?id=iBn2Rj26F6},
}
Figure