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: Bound wd_nodes JSON array parsing in get_pool_config_from_json.
Date: Tue, 29 Sep 2026 04:43:11 +0000
Message-ID: <E1xBPgN-00000002gHE-2kz7@gothos.postgresql.org> (raw)

Bound wd_nodes JSON array parsing in get_pool_config_from_json.

In src/watchdog/wd_json_data.c get_pool_config_from_json(), the loop
over the peer-supplied "wd_nodes" JSON array writes into
config->wd_nodes.wd_node_info[i] using the array length declared by
the peer. The destination is a fixed-size array of MAX_WATCHDOG_NUM
(128) WdNodeInfo entries (see WdNodesConfig in src/include/pool_config.h),
but no upper bound is enforced before the loop, so a peer that ships
a wd_nodes array of length > 128 walks the loop index past the end
of the array and writes peer-controlled host/port data into adjacent
heap memory.

This is the wd_nodes half of PGP-0001 (the backend_desc half is
addressed in a sibling patch). Reject any wd_nodes array whose
declared length exceeds MAX_WATCHDOG_NUM via ereport(ERROR, ...) so
the JSON is dropped before any out-of-bounds write occurs.

Inline bound check (rather than a shared parse_peer_count helper) so
this patch is self-contained and back-portable independently of any
helper migration.

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

Branch
------
V4_6_STABLE

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

Modified Files
--------------
src/watchdog/wd_json_data.c | 6 ++++++
1 file changed, 6 insertions(+)



view thread (6+ messages)  latest in thread

Message-ID: <E1xBPgN-00000002gHE-2kz7@gothos.postgresql.org>
Permalink:  ../E1xBPgN-00000002gHE-2kz7@gothos.postgresql.org/
Also on:    postgresql.org/message-id/E1xBPgN-00000002gHE-2kz7@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: Bound wd_nodes JSON array parsing in get_pool_config_from_json.
  In-Reply-To: <E1xBPgN-00000002gHE-2kz7@gothos.postgresql.org>
  References: <E1xBPgN-00000002gHE-2kz7@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