postgresql/contrib/pgcrypto/sql
Noah Misch 8f8b1ffac0 Require PGP-decrypted text to pass encoding validation.
pgp_sym_decrypt() and pgp_pub_decrypt() will raise such errors, while
bytea variants will not.  The existing "dat3" test decrypted to non-UTF8
text, so switch that query to bytea.

The long-term intent is for type "text" to always be valid in the
database encoding.  pgcrypto has long been known as a source of
exceptions to that intent, but a report about exploiting invalid values
of type "text" brought this module to the forefront.  This particular
exception is straightforward to fix, with reasonable effect on user
queries.  Back-patch to v14 (all supported versions).

Reported-by: Paul Gerste (as part of zeroday.cloud)
Reported-by: Moritz Sanft (as part of zeroday.cloud)
Author: shihao zhong <zhong950419@gmail.com>
Reviewed-by: cary huang <hcary328@gmail.com>
Discussion: https://postgr.es/m/CAGRkXqRZyo0gLxPJqUsDqtWYBbgM14betsHiLRPj9mo2=z9VvA@mail.gmail.com
Backpatch-through: 14
Security: CVE-2026-2006
2026-02-09 06:14:52 -08:00
..
3des.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
blowfish.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
cast5.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
crypt-blowfish.sql pgcrypto: Detect and report too-short crypt() salts. 2015-10-05 10:06:29 -04:00
crypt-des.sql pgcrypto: Detect and report too-short crypt() salts. 2015-10-05 10:06:29 -04:00
crypt-md5.sql Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
crypt-xdes.sql pgcrypto: Detect and report too-short crypt() salts. 2015-10-05 10:06:29 -04:00
des.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
hmac-md5.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
hmac-sha1.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
init.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
md5.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
pgp-armor.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
pgp-compression.sql Fix corner case with 16kB-long decompression in pgcrypto, take 2 2020-07-27 15:58:32 +09:00
pgp-decrypt.sql Require PGP-decrypted text to pass encoding validation. 2026-02-09 06:14:52 -08:00
pgp-encrypt.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
pgp-info.sql Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
pgp-pubkey-decrypt.sql Fix buffer overrun after incomplete read in pullf_read_max(). 2015-02-02 10:00:45 -05:00
pgp-pubkey-encrypt.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
pgp-pubkey-session.sql pgcrypto: Fix buffer overflow in pgp_pub_decrypt_bytea() 2026-02-09 08:01:10 +09:00
pgp-zlib-DISABLED.sql Remove extra newlines at end and beginning of files, add missing newlines 2010-08-19 05:57:36 +00:00
rijndael.sql pgcrypto: Remove internal padding implementation 2022-03-22 08:58:44 +01:00
sha1.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00
sha2.sql pgcrypto: Remove explicit hex encoding/decoding from tests 2021-12-08 06:06:22 +01:00