pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Convert newlines to spaces in names written in v11+ pg_dump comm
Date: Mon, 11 Aug 2025 13:22:13 +0000
Message-ID: <E1ulSTd-00026d-2h@gemulon.postgresql.org> (raw)

Convert newlines to spaces in names written in v11+ pg_dump comments.

Maliciously-crafted object names could achieve SQL injection during
restore.  CVE-2012-0868 fixed this class of problem at the time, but
later work reintroduced three cases.  Commit
bc8cd50fefd369b217f80078585c486505aafb62 (back-patched to v11+ in
2023-05 releases) introduced the pg_dump case.  Commit
6cbdbd9e8d8f2986fde44f2431ed8d0c8fce7f5d (v12+) introduced the two
pg_dumpall cases.  Move sanitize_line(), unchanged, to dumputils.c so
pg_dumpall has access to it in all supported versions.  Back-patch to
v13 (all supported versions).

Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Backpatch-through: 13
Security: CVE-2025-8715

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9b92f115bdf9f21e9a8c4dcd80207c0723e81c3b

Modified Files
--------------
src/bin/pg_dump/dumputils.c                  | 37 ++++++++++++++++++++++++++++
src/bin/pg_dump/dumputils.h                  |  1 +
src/bin/pg_dump/pg_backup_archiver.c         | 37 ----------------------------
src/bin/pg_dump/pg_dump.c                    |  5 +++-
src/bin/pg_dump/pg_dumpall.c                 | 13 ++++++++--
src/bin/pg_dump/t/002_pg_dump.pl             | 21 ++++++++++++++++
src/bin/pg_dump/t/003_pg_dump_with_server.pl | 17 ++++++++++++-
7 files changed, 90 insertions(+), 41 deletions(-)



view thread (12+ messages)  latest in thread

Message-ID: <E1ulSTd-00026d-2h@gemulon.postgresql.org>
Permalink:  ../E1ulSTd-00026d-2h@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1ulSTd-00026d-2h@gemulon.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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Convert newlines to spaces in names written in v11+ pg_dump comm
  In-Reply-To: <E1ulSTd-00026d-2h@gemulon.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