CSE Roadmap

Core tier · about 4 hours · 9 parts

Part 6 of 9 · 1 min read

Data at rest

Assume someone gets the disk, and make it useless to them.

BM says data lying around is a liability. Many high-profile breaches involved stolen data that the attacker could read, because it was stored without encryption or the protection was flawed. Its advice:

  • Use well-known tools. The easiest way to fail is to write your own encryption. Use reviewed, patched implementations of well-regarded algorithms. For data at rest BM suggests AES-128 or AES-256 unless there is a very good reason, and says to follow security advisories and patch. For passwords, use salted password hashing: store a salted hash, not the password. Badly done encryption can be worse than none, since it gives false comfort.
  • Pick your targets. Encrypting everything removes guesswork but costs computing power and complicates database migrations, which may need data to be decrypted, migrated and encrypted again. Limiting encryption to a known set of tables is sensible.
  • Decrypt on demand. Encrypt data as soon as it is first seen. Decrypt only when needed, and never store the plain version.
  • Encrypt backups. They hold the same sensitive data. Know which keys decrypt which version of the data, especially when keys change.

A made-up case. A table of 10 million customers holds card tokens and addresses. Only the tokens column is encrypted, the key sits in a vault, and backups are encrypted with a key that rotates every 90 days. If a backup tape is lost, an attacker gets addresses but no card data.

Encryption at rest

Encryption at rest means data stored on disk or in a backup is encrypted, so that stealing the storage does not reveal the content.

Example: a stolen backup file is useless without the key held in the vault.

Check yourself: 1. Why not write your own encryption? 2. Why encrypt backups? 3. What is the cost of encrypting every column?