Jorge Turbica / blog · Blog ← All articles ES · Leer en español
Technologies

PostgreSQL patches 52 vulnerabilities at once, 28 of them code execution: get 18.7

PostgreSQL 18.7, 17.12, 16.16, 15.20 and 14.25 fix 52 CVEs, 32 rated CVSS 8.8, and ask for REINDEX and a fresh full backup after updating.

Fifty-two vulnerabilities in a single minor update, and 28 of them allow arbitrary code execution. PostgreSQL 18.7, 17.12, 16.16, 15.20 and 14.25, released on 12 November 2026, patch every supported branch at once and also fix more than 140 bugs, several of which corrupt indexes and backups. This is not a patch to leave for the next maintenance window.

What got fixed

Of the 52 CVEs, 32 score 8.8 on CVSS 3.1. Most follow the same pattern: an authenticated user with no special privileges gets the server to read a value as a different type from the one it had (type confusion) or to reuse freed memory, and from there runs code as the operating system user that owns the database process.

Top of the list is CVE-2026-6460. According to the official advisory, anyone who can create objects can execute code through ALTER ... SET DATA TYPE, and there are other DDL routes, such as adding a column, rolling back and adding it again. The root cause is a design gap: the system did not track the types of values properly, and values did not identify themselves, so stale values could linger in the data dictionary, in PL/pgSQL variables and elsewhere. Mehmet Ince, one of the researchers who reported it, has published how he turned that primitive, which dates back to a 2004 commit, into remote code execution on PostgreSQL 18.6, with no extensions and from an ordinary SQL session.

Around that family there is more: type confusion in min/max aggregates, statistics import and output parameters, five bugs in plperl, one in pltcl and one in dblink. And not all of it is server-side:

  • CVE-2026-116314 (8.8): pg_restore can run code on the machine doing the restore if the archive has been tampered with.
  • CVE-2026-116318 and CVE-2026-116330 (8.8): SQL injection in pg_dump through a NOT NULL constraint name, and psql command injection in a tar-format restore.sql.
  • CVE-2026-116325 (8.0): SQL injection in reindexdb through index name quoting.

Who is really exposed

CVE-2026-6460 is network-reachable, needs low privileges and no user interaction. What changes your risk is who has an account on your database. If every application has its own role and nobody else connects, an attacker first needs a SQL injection or a stolen credential; once they have it, the jump from reading tables to running code on the host is no longer theoretical. If you offer PostgreSQL to third parties (multi-tenant platforms, analytics environments where users write SQL, shared labs), you are in the worst case and the update is urgent.

The client tools extend the problem to anyone restoring someone else's backups: running pg_restore on a dump you did not create is no longer harmless until the client is updated.

What to do after updating

The update only swaps binaries, with no pg_dump or pg_upgrade, but this time there is homework. The release announcement asks you to:

  • Reindex GIN indexes that may be damaged, pg_trgm GiST indexes using gist_trgm_ops, B-tree indexes on bpchar columns declared without a length (char(n) is not affected), and any table that throws missing chunk number errors.
  • Take a fresh full backup if you use incremental backups, and base later incrementals on it.
  • Review NOT NULL NO INHERIT constraints on partitioned tables, which are now rejected because they let partitions hold NULLs.

How to update

Check what you run with SELECT version();. On Debian or Ubuntu with the PGDG repository, for the 18 branch:

bash
sudo apt update
sudo apt install --only-upgrade postgresql-18 postgresql-client-18
sudo systemctl restart postgresql

In containers, pin the minor version tag (postgres:18.7, postgres:17.12…) instead of postgres:18, so you know which binary runs in each environment. On managed services, check when your provider rolls out the minor version and whether you can trigger maintenance yourself.

Then, in every database with partitioned tables, find the affected constraints with the query from the release announcement:

sql
SELECT conrelid::regclass, conname
FROM pg_constraint
WHERE contype = 'n' AND connoinherit
  AND conrelid IN (SELECT oid FROM pg_class WHERE relkind = 'p');

Constraints you want to keep are repaired with ALTER TABLE ... ALTER CONSTRAINT ... INHERIT, which fails if any partition holds NULLs in that column.

Before it reaches production

  • Update a replica or a staging environment with real data first and run your query tests: the announcement notes that the planner's join removal has been rewritten, an unusual change for a minor release.
  • Schedule the REINDEX work off-peak, or use REINDEX ... CONCURRENTLY for large indexes.
  • Update the clients too (pg_dump, pg_restore, psql, reindexdb) on backup and CI machines, not just the server.
  • Take the fresh full backup before running incrementals again.

PostgreSQL 14 is out of patches

14.25 is the last release of that branch: PostgreSQL 14 is now end-of-life and will get no further fixes. If it is still in production, this batch is the last one that covers you, and the next serious bug will go unpatched. PostgreSQL 19 is at its second release candidate, with general availability planned for 19 November.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗