pg.ddx.io  pgpool-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Taiki Koshino <koshino@sraoss.co.jp>
To: pgpool-committers@lists.postgresql.org
Subject: pgpool: NULL-check json_get_value_for_key inputs and outputs in watchdo
Date: Tue, 29 Sep 2026 04:41:29 +0000
Message-ID: <E1xBPej-00000002e8G-1e97@gothos.postgresql.org> (raw)

NULL-check json_get_value_for_key inputs and outputs in watchdog auth path.

A peer that opens a TCP connection to wd_port and sends a well-formed
WD_ADD_NODE_MESSAGE whose JSON body omits the "authkey" field reaches
verify_authhash_for_node() with authhash == NULL.  When wd_authkey is
configured, the function calls strcmp(calculated_authhash, authhash)
unconditionally, faulting the watchdog process.  Because PT_WATCHDOG is
respawned by the parent, an attacker can loop the request and deny all
cluster coordination (no failover, no quorum, no state transitions) for
as long as the connection is reachable.

The same shape exists one layer down in json_get_value_for_key(): the
function dereferences source->type without checking source first.  Any
chained call of the form json_get_value_for_key(json_get_value_for_key(
root, "X"), "Y") -- where the inner lookup returns NULL because the
peer omitted the field -- crashes the watchdog the same way.

Add minimal NULL guards in both places:

  * json_get_value_for_key() returns NULL when source is NULL, matching
    the contract the existing callers (json_get_int_value_for_key,
    json_get_string_value_for_key, etc.) already assume on its return
    value.
  * verify_authhash_for_node() rejects the peer with ereport(WARNING)
    when the parsed authhash is NULL, so a missing authkey field is
    treated as authentication failure rather than a crash.

Reported-by: Emond Papegaaij <emond.papegaaij@topicus.nl>
Reported-by: Claude
Author: Bo Peng <pengbo@sraoss.co.jp>
CVE-2026-92871
Backpatch-through: v4.3

Branch
------
V4_7_STABLE

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=e2862d82acb0d7f112d9d0111ea232226be14...

Modified Files
--------------
src/utils/json.c        |  2 ++
src/watchdog/watchdog.c | 10 ++++++++++
2 files changed, 12 insertions(+)



view thread (6+ messages)  latest in thread

Message-ID: <E1xBPej-00000002e8G-1e97@gothos.postgresql.org>
Permalink:  ../E1xBPej-00000002e8G-1e97@gothos.postgresql.org/
Also on:    postgresql.org/message-id/E1xBPej-00000002e8G-1e97@gothos.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgpool-committers@postgresql.org
  Cc: koshino@sraoss.co.jp
  Subject: Re: pgpool: NULL-check json_get_value_for_key inputs and outputs in watchdo
  In-Reply-To: <E1xBPej-00000002e8G-1e97@gothos.postgresql.org>
  References: <E1xBPej-00000002e8G-1e97@gothos.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox