]> granicus.if.org Git - postgresql/commit
pgcrypto: Report errant decryption as "Wrong key or corrupt data".
authorNoah Misch <noah@leadboat.com>
Mon, 18 May 2015 14:02:31 +0000 (10:02 -0400)
committerNoah Misch <noah@leadboat.com>
Mon, 18 May 2015 14:02:38 +0000 (10:02 -0400)
commite5981aebde61521d8dcace6f45b52d1dc9035a90
tree347b399f1e9225e2291f7d6c9daeb9f676e907da
parent2cb9f2cabe3071f1cbd25ab8fe3cbc0b8d1a83d3
pgcrypto: Report errant decryption as "Wrong key or corrupt data".

This has been the predominant outcome.  When the output of decrypting
with a wrong key coincidentally resembled an OpenPGP packet header,
pgcrypto could instead report "Corrupt data", "Not text data" or
"Unsupported compression algorithm".  The distinct "Corrupt data"
message added no value.  The latter two error messages misled when the
decrypted payload also exhibited fundamental integrity problems.  Worse,
error message variance in other systems has enabled cryptologic attacks;
see RFC 4880 section "14. Security Considerations".  Whether these
pgcrypto behaviors are likewise exploitable is unknown.

In passing, document that pgcrypto does not resist side-channel attacks.
Back-patch to 9.0 (all supported versions).

Security: CVE-2015-3167
contrib/pgcrypto/expected/pgp-decrypt.out
contrib/pgcrypto/expected/pgp-pubkey-decrypt.out
contrib/pgcrypto/mbuf.c
contrib/pgcrypto/pgp-decrypt.c
contrib/pgcrypto/pgp.h
contrib/pgcrypto/px.c
contrib/pgcrypto/px.h
contrib/pgcrypto/sql/pgp-decrypt.sql
doc/src/sgml/pgcrypto.sgml