pgpool2.git / summary / log / commit / refs
commit d0a783343ce8e6331a78e2d086b184f504d15b84
Author: Taiki Koshino <koshino@sraoss.co.jp>
Date: Sun Sep 20 03:37:42 2026 +0000
Reject client certificate CN containing embedded NUL byte.
X509_NAME_get_text_by_NID returns the ASN.1 byte length of the Common
Name string. pgpool stored the buffer as a C string and later compared
it to the HBA-supplied username with strcasecmp(). If the certificate
CN contains an embedded NUL byte (e.g. "target\0attacker"), the
ASN.1-length view of the name and the C-string view disagree:
strcasecmp() truncates at the embedded NUL, so a peer presenting a
maliciously crafted certificate authenticates as the prefix.
Reject the certificate when the C-string length of the extracted CN
differs from the byte length returned by X509_NAME_get_text_by_NID().
Reported-by: Emond Papegaaij <emond.papegaaij@topicus.nl>
Reported-by: Claude
Author: Bo Peng <pengbo@sraoss.co.jp>
CVE-2026-92868
Backpatch-through: v4.3
src/utils/pool_ssl.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/utils/pool_ssl.c b/src/utils/pool_ssl.c
index 7a5af7ca4..ca36baa75 100644
--- a/src/utils/pool_ssl.c
+++ b/src/utils/pool_ssl.c
@@ -519,6 +519,12 @@ fetch_pool_ssl_cert(POOL_CONNECTION *cp)
pfree(peer_cn);
return;
}
+ if ((size_t) len != strlen(peer_cn))
+ {
+ pfree(peer_cn);
+ ereport(ERROR,
+ (errmsg("client certificate Common Name contains embedded NUL")));
+ }
cp->client_cert_loaded = true;
cp->cert_cn = MemoryContextStrdup(TopMemoryContext, peer_cn);
pfree(peer_cn);
[parent: 0388652d1b6f]