pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pg_restore: Fix out-of-bounds accesses and path traversal.
3+ messages / 1 participants
[nested] [flat]

* pgsql: pg_restore: Fix out-of-bounds accesses and path traversal.
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_restore: Fix out-of-bounds accesses and path traversal.

pg_restore trusts the contents of the archives it reads, so a
maliciously crafted archive can cause out-of-bounds reads and
writes, or make pg_restore read files outside the archive
directory.  This commit fixes the following issues:

* Dependency IDs read from the table of contents are used as array
  subscripts without validation.  To fix, reject any that is not a
  positive integer.

* _getObjectDescription() and IssueACLPerBlob() can read past the
  end of a string when an entry's DROP statement or large object
  ACL has an unexpected form.  To fix, check for the expected
  prefix before moving past it.

* A crafted archive can cause the dump ID index to be built before
  the table of contents has been read, in which case it is too
  small for every later lookup.  To fix, have the tar format reject
  archives whose table of contents is not the first member.

* The directory format opens the files named in the archive
  without inspecting them.  To fix, reject names that contain a
  directory separator and anything that isn't a regular file.

* A tar member length that does not fit in a pgoff_t can cause a
  buffer overrun on 32-bit systems.  To fix, reject such lengths.

* In the back-branches, buildTocEntryArrays() sizes the dump ID
  index arrays with unchecked multiplication, which could overflow
  size_t on 32-bit systems.  To fix, use pg_malloc0_array().

A corrupt archive can still crash pg_restore in other ways, but
hardening against that didn't seem appropriate for a security fix,
and therefore it is left as a future exercise.

Reported-by: Dilip Kumar <dilipbalaut@gmail.com>
Reported-by: Yonghwa Lee <underdog@theori.io>
Reported-by: OpenSec <security@opensec.in>
Reported-by: Ben Dixon <uk.bendixon@gmail.com>
Author: Dilip Kumar <dilipbalaut@gmail.com>
Author: Yonghwa Lee <underdog@theori.io>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Security: CVE-2026-116314
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4056493220e78027ecba88761c1d80947cd494d5
Author: Nathan Bossart <nathan@postgresql.org>

Modified Files
--------------
src/bin/pg_dump/compress_io.c         | 31 +++++++++++++++++++++++++++++++
src/bin/pg_dump/pg_backup_archiver.c  | 25 ++++++++++++++++++++++---
src/bin/pg_dump/pg_backup_db.c        |  8 +++++++-
src/bin/pg_dump/pg_backup_directory.c |  4 ++++
src/bin/pg_dump/pg_backup_tar.c       | 20 ++++++++++++++++++++
5 files changed, 84 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: pg_restore: Fix out-of-bounds accesses and path traversal.
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_restore: Fix out-of-bounds accesses and path traversal.

pg_restore trusts the contents of the archives it reads, so a
maliciously crafted archive can cause out-of-bounds reads and
writes, or make pg_restore read files outside the archive
directory.  This commit fixes the following issues:

* Dependency IDs read from the table of contents are used as array
  subscripts without validation.  To fix, reject any that is not a
  positive integer.

* _getObjectDescription() and IssueACLPerBlob() can read past the
  end of a string when an entry's DROP statement or large object
  ACL has an unexpected form.  To fix, check for the expected
  prefix before moving past it.

* A crafted archive can cause the dump ID index to be built before
  the table of contents has been read, in which case it is too
  small for every later lookup.  To fix, have the tar format reject
  archives whose table of contents is not the first member.

* The directory format opens the files named in the archive
  without inspecting them.  To fix, reject names that contain a
  directory separator and anything that isn't a regular file.

* A tar member length that does not fit in a pgoff_t can cause a
  buffer overrun on 32-bit systems.  To fix, reject such lengths.

* In the back-branches, buildTocEntryArrays() sizes the dump ID
  index arrays with unchecked multiplication, which could overflow
  size_t on 32-bit systems.  To fix, use pg_malloc0_array().

A corrupt archive can still crash pg_restore in other ways, but
hardening against that didn't seem appropriate for a security fix,
and therefore it is left as a future exercise.

Reported-by: Dilip Kumar <dilipbalaut@gmail.com>
Reported-by: Yonghwa Lee <underdog@theori.io>
Reported-by: OpenSec <security@opensec.in>
Reported-by: Ben Dixon <uk.bendixon@gmail.com>
Author: Dilip Kumar <dilipbalaut@gmail.com>
Author: Yonghwa Lee <underdog@theori.io>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Security: CVE-2026-116314
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1f0ccd2f81fc78ff399c0295a0cdc36a64f13554
Author: Nathan Bossart <nathan@postgresql.org>

Modified Files
--------------
src/bin/pg_dump/compress_io.c         | 31 +++++++++++++++++++++++++++++++
src/bin/pg_dump/pg_backup_archiver.c  | 25 ++++++++++++++++++++++---
src/bin/pg_dump/pg_backup_db.c        |  8 +++++++-
src/bin/pg_dump/pg_backup_directory.c |  4 ++++
src/bin/pg_dump/pg_backup_tar.c       | 20 ++++++++++++++++++++
5 files changed, 84 insertions(+), 4 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: pg_restore: Fix out-of-bounds accesses and path traversal.
@ 2026-11-09 14:21 Noah Misch <noah@leadboat.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_restore: Fix out-of-bounds accesses and path traversal.

pg_restore trusts the contents of the archives it reads, so a
maliciously crafted archive can cause out-of-bounds reads and
writes, or make pg_restore read files outside the archive
directory.  This commit fixes the following issues:

* Dependency IDs read from the table of contents are used as array
  subscripts without validation.  To fix, reject any that is not a
  positive integer.

* _getObjectDescription() and IssueACLPerBlob() can read past the
  end of a string when an entry's DROP statement or large object
  ACL has an unexpected form.  To fix, check for the expected
  prefix before moving past it.

* A crafted archive can cause the dump ID index to be built before
  the table of contents has been read, in which case it is too
  small for every later lookup.  To fix, have the tar format reject
  archives whose table of contents is not the first member.

* The directory format opens the files named in the archive
  without inspecting them.  To fix, reject names that contain a
  directory separator and anything that isn't a regular file.

* A tar member length that does not fit in a pgoff_t can cause a
  buffer overrun on 32-bit systems.  To fix, reject such lengths.

* In the back-branches, buildTocEntryArrays() sizes the dump ID
  index arrays with unchecked multiplication, which could overflow
  size_t on 32-bit systems.  To fix, use pg_malloc0_array().

A corrupt archive can still crash pg_restore in other ways, but
hardening against that didn't seem appropriate for a security fix,
and therefore it is left as a future exercise.

Reported-by: Dilip Kumar <dilipbalaut@gmail.com>
Reported-by: Yonghwa Lee <underdog@theori.io>
Reported-by: OpenSec <security@opensec.in>
Reported-by: Ben Dixon <uk.bendixon@gmail.com>
Author: Dilip Kumar <dilipbalaut@gmail.com>
Author: Yonghwa Lee <underdog@theori.io>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Security: CVE-2026-116314
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/673ef2341e3f6263f301c8f0b0f5c935bfea773a
Author: Nathan Bossart <nathan@postgresql.org>

Modified Files
--------------
src/bin/pg_dump/compress_io.c         | 31 +++++++++++++++++++++++++++++++
src/bin/pg_dump/pg_backup_archiver.c  | 29 ++++++++++++++++++++++++-----
src/bin/pg_dump/pg_backup_db.c        |  8 +++++++-
src/bin/pg_dump/pg_backup_directory.c |  4 ++++
src/bin/pg_dump/pg_backup_tar.c       | 20 ++++++++++++++++++++
5 files changed, 86 insertions(+), 6 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-11-09 14:21 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-09 14:21 pgsql: pg_restore: Fix out-of-bounds accesses and path traversal. Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: pg_restore: Fix out-of-bounds accesses and path traversal. Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: pg_restore: Fix out-of-bounds accesses and path traversal. Noah Misch <noah@leadboat.com>

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