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: Reject node count larger than MAX_NUM_BACKENDS in parse_wd_node
Date: Tue, 29 Sep 2026 04:43:39 +0000
Message-ID: <E1xBPgp-00000002gdw-2dE4@gothos.postgresql.org> (raw)

Reject node count larger than MAX_NUM_BACKENDS in parse_wd_node_function_json.

parse_wd_node_function_json() in src/watchdog/wd_json_data.c parses a
peer-supplied NodeCount and a NodeIdList array out of a watchdog JSON
message and palloc()s an int array of node_count entries to populate.
The downstream consumer degenerate_backend_set_ex() in
src/main/pool_internal_comms.c declares

    int node_id[MAX_NUM_BACKENDS];

(128 ints, 512 bytes) on the stack and copies up to node_count entries
into it. A peer that sets NodeCount above MAX_NUM_BACKENDS therefore
writes past the stack buffer in the failover-command path, which is
reachable from WD_IPC_FAILOVER_COMMAND and wd_authkey is not set.

Bound node_count at the parser, before the palloc, so an out-of-range
value is rejected via ereport(ERROR) and never reaches the downstream
fixed-size stack array.

Reported-by: Emond Papegaaij <emond.papegaaij@topicus.nl>
Reported-by: Claude
Author: Tatsuo Ishii <ishii@postgresql.org>
CVE-2026-92870
Backpatch-through: v4.3

Branch
------
V4_5_STABLE

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

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



view thread (6+ messages)  latest in thread

Message-ID: <E1xBPgp-00000002gdw-2dE4@gothos.postgresql.org>
Permalink:  ../E1xBPgp-00000002gdw-2dE4@gothos.postgresql.org/
Also on:    postgresql.org/message-id/E1xBPgp-00000002gdw-2dE4@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: Reject node count larger than MAX_NUM_BACKENDS in parse_wd_node
  In-Reply-To: <E1xBPgp-00000002gdw-2dE4@gothos.postgresql.org>
  References: <E1xBPgp-00000002gdw-2dE4@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