On Wed, Jun 20, 2018 at 05:16:46PM -0400, Bruce Momjian wrote:
> On Mon, Jun 18, 2018 at 12:29:57PM -0500, Nico Williams wrote:
> > Note that unless the pg_catalog is protected against manipulation by
> > remote storage, then TDE for user tables might be possible to
> > compromise. Like so: the attacker manipulates the pg_catalog to
> > escalate privelege in order to obtain the TDE keys. This argues for
> > full database encryption, not just specific tables or columns. But
> > again, this is for the threat model where the storage is the threat.
>
> Yes, one big problem with per-column encryption is that administrators
> can silently delete data, though they can't add or modify it.
They can also re-add ("replay") deleted values; this can only be
defeated by also binding TX IDs or alike in the ciphertext. And if you
don't bind the encrypted values to the PKs then they can add any value
they've seen to different rows.
One can protect to some degree agains replay and reuse attacks, but
protecting against silent deletion is much harder. Protecting against
the rows (or the entire DB) being restored at a past point in time is
even harder -- you quickly end up wanting Merkle hash/MAC trees and key
rotation, but this complicates everything and is performance killing.
> > I think any threat model where DBAs are not the threat is just not that
> > interesting to address with crypto within postgres itself...
>
> Yes, but in my analysis the only solution there is client-side
> encryption:
For which threat model?
For threat models where the DBAs are not the threat there's no need for
client-side encryption: just encrypt the storage at the postgres
instance (with encrypting device drivers or -preferably- filesystems).
For threat models where the DBAs are the threat then yes, client-side
encryption works (or server-side encryption to public keys), but you
must still bind the encrypted values to the primary keys, and you must
provide integrity protection for as much data as possible -- see above.
Client-side crypto is hard to do well and still get decent performance.
So on the whole I think that crypto is a poor fit for the DBAs-are-the-
threat threat model. It's better to reduce the number of DBAs/sysadmins
and audit all privileged (and, for good measure, unprivileged) access.
Client-side encryption, of course, wouldn't be a feature of PG..., as PG
is mostly a very smart server + very dumb clients. The client could be
a lot smarter, for sure -- it could be a full-fledged RDBMS, it could
even be a postgres instance accessing the real server via FDW.
For example, libgda, the GNOME Data Assistant, IIRC, is a smart client
that uses SQLite3 to access remote resources via virtual table
extensions that function a lot like PG's FDW. This works well because
SQLite3 is embeddable and light-weight. PG wouldn't fit that bill as
well, but one could start a PG instance to proxy a remote one via FDW,
with crypto done in the proxy.
> http://momjian.us/main/writings/crypto_hw_use.pdf#page=97
>
> You might want to look at the earlier slides too.
I will, thanks.
Nico
--