> ## Documentation Index
> Fetch the complete documentation index at: https://blog.onetsolutions.net/llms.txt
> Use this file to discover all available pages before exploring further.

# PostgreSQL CVE-2026-6460: code execution through ALTER TABLE

> PostgreSQL flaw CVE-2026-6460 lets any account that creates objects run code on the server. Fixed in 18.7 to 14.25: exposure, updates per distro, checks.

*Published on November 17, 2026*

> [!WARNING]
>
> **CVE-2026-6460 — PostgreSQL server, every supported branch.** An account that can create objects in a database runs code on the machine, as the operating system user that runs PostgreSQL. Versions 18.7, 17.12, 16.16, 15.20 and 14.25, released on November 12, 2026, fix the flaw. Update and restart PostgreSQL.

## The bug in two sentences

PostgreSQL did not track the type of the values it handles closely enough, and those values did not carry their type with them. After an `ALTER TABLE … ALTER COLUMN … SET DATA TYPE`, stale values could linger in the data dictionary, in PL/pgSQL variables and elsewhere: the server then reads them with the wrong type, a type confusion (CWE-843) that leads to code execution.

The PostgreSQL advisory lists other DDL routes, such as `ALTER TABLE … ADD COLUMN; ROLLBACK; ALTER TABLE … ADD COLUMN`.

Affected versions:

* **PostgreSQL 18** before 18.7, **17** before 17.12, **16** before 16.16, **15** before 15.20;
* **PostgreSQL 14** before 14.25, and every older version according to the CVE record.

The PostgreSQL project scores the flaw **8.8** under CVSS 3.1 (`AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`). Red Hat uses the same score and rates it Important. The NVD entry carries the project's score while awaiting its own analysis. Ubuntu gives it medium priority.

Researcher Mehmet Ince published a technical write-up on November 9, 2026. He reports triggering the crash with the least privileged login role, by creating his types in the session's temporary schema.

> [!NOTE]
>
> The flaw is not in CISA's Known Exploited Vulnerabilities (KEV) catalog (November 13, 2026 version), and CISA records no exploitation. The same release fixes 52 vulnerabilities, including several other 8.8 code execution flaws: one update covers them all.

## Sizing your exposure

The question to ask: **who can log in to your PostgreSQL server?** An account that creates objects is enough. An application that creates its own tables, as most frameworks' migrations do, holds that right.

| Profile | Exposure | Action |
| - | - | - |
| PostgreSQL server shared by several applications, customers or teams | **High**: every account can target the `postgres` system user | Update today |
| Port 5432 open to the Internet | **High**: a guessed or stolen password is enough | Update and filter the port |
| Single application, PostgreSQL reachable locally or on a private network | Moderate: the attacker first needs SQL access | Update soon |
| Docker container or Kubernetes pod on the `postgres` image | Depends on the image tag | Move to the fixed tag and recreate the container |
| PostgreSQL 14 | Fixed in 14.25, the last release of the branch | Update, then plan a move to a supported version |
| PostgreSQL 13 and older | No longer receives fixes from the project | Move to a supported branch |

To find the running version:

```bash theme={null}
# Version of the running server
sudo -u postgres psql -c 'SHOW server_version;'

# Debian and Ubuntu: installed clusters, version and status
pg_lsclusters
```

To see who can log in and create objects:

```bash theme={null}
# Roles and their attributes
sudo -u postgres psql -c '\du'

# Schemas and their privileges (C = create)
sudo -u postgres psql -d <database> -c '\dn+'
```

## Updating PostgreSQL per distribution

A minor update needs no dump and no `pg_upgrade`: the project says you only need to stop PostgreSQL and update its binaries. The server must be restarted to load the fixed version.

Take a [snapshot of your VPS](https://help.onetsolutions.net/vps/snapshot) first.

### Debian

| Release | Package | Fixed version | Advisory |
| - | - | - | - |
| Debian 13 (trixie) | `postgresql-17` | `17.12-0+deb13u1` | DSA-6625-1 |
| Debian 12 (bookworm) | `postgresql-15` | `15.20-0+deb12u1` | DLA-4905-1 |
| Debian testing (forky) and unstable (sid) | `postgresql-18` | `18.7-1` | — |

```bash theme={null}
# Debian 13: update PostgreSQL 17
sudo apt update && sudo apt install --only-upgrade postgresql-17

# Debian 12: update PostgreSQL 15
sudo apt update && sudo apt install --only-upgrade postgresql-15

# Restart the cluster (17/main here, adjust to pg_lsclusters)
sudo systemctl restart postgresql@17-main
```

### Ubuntu

As of November 17, 2026, Ubuntu is still assessing the flaw: the `postgresql-14` (22.04 LTS), `postgresql-16` (24.04 LTS) and `postgresql-18` (26.04 LTS) packages have no fixed version yet. Follow [Ubuntu's CVE page](https://ubuntu.com/security/CVE-2026-6460).

The project's official repository, `apt.postgresql.org`, already ships the fixed versions for Debian 12, Debian 13, Ubuntu 22.04 and Ubuntu 24.04. If your server uses it:

```bash theme={null}
# apt.postgresql.org: update the installed branch (17 here)
sudo apt update && sudo apt install --only-upgrade postgresql-17
sudo systemctl restart postgresql@17-main
```

### RHEL and AlmaLinux

As of November 17, 2026, Red Hat lists the PostgreSQL packages of RHEL 8, 9 and 10 as under investigation: no fix is out yet for these releases. AlmaLinux follows RHEL's fixes.

The project's official repository, `download.postgresql.org`, ships the fixed versions for RHEL 8, 9 and 10 and their derivatives: `18.7`, `17.12`, `16.16`, `15.20` and `14.25`. If your server uses it:

```bash theme={null}
# PGDG repository: update the installed branch (17 here)
sudo dnf upgrade 'postgresql17*'
sudo systemctl restart postgresql-17
```

### Docker and Kubernetes

The official `postgres` image on Docker Hub has carried the `18.7`, `17.12`, `16.16`, `15.20` and `14.25` tags since November 15, 2026. Branch tags (`17`, for example) point to the fixed version.

```bash theme={null}
# Docker Compose: pull the fixed image and recreate the container
docker compose pull && docker compose up -d

# Kubernetes: move the StatefulSet to the fixed tag
kubectl set image statefulset/<name> <container>=postgres:17.12
```

### C extensions

The release notes state that full protection requires rebuilding C-language extensions, and that some will need source code changes. Debian plans to rebuild its extensions in upcoming trixie point releases.

An extension you compiled yourself must be rebuilt against the new PostgreSQL version. To list a database's extensions:

```bash theme={null}
sudo -u postgres psql -d <database> -c 'SELECT extname, extversion FROM pg_extension ORDER BY 1;'
```

> [!NOTE]
>
> The update adds the `composite_type_mismatch` server parameter. It can turn off the new checks, but the release notes warn that doing so carries security risks: leave it at its default value.

## Reducing exposure until you update

Red Hat suggests two measures to apply until the fix is installed.

Restrict network access to the PostgreSQL port to trusted administration hosts. On RHEL and AlmaLinux, with firewalld:

```bash theme={null}
# Remove PostgreSQL from the public zone
sudo firewall-cmd --permanent --remove-service=postgresql

# Allow trusted addresses only
sudo firewall-cmd --permanent --zone=trusted --add-source=<trusted_ip_or_network>

# Apply (may drop active sessions)
sudo firewall-cmd --reload
```

On an OnetSolutions VPS, whatever the distribution, the [console firewall](https://help.onetsolutions.net/vps/firewall) also limits inbound traffic on port 5432 to the addresses you allow.

Revoke the create privilege on the `public` schema from untrusted accounts:

```sql theme={null}
-- Run in each affected database
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
```

Red Hat warns that this can block applications that create tables on the fly, until they are granted explicit privileges.

> [!NOTE]
>
> Since PostgreSQL 15, a new database no longer grants this privilege to `PUBLIC`, but a migrated or restored database keeps its original privileges. Revoking it does not cover the session's temporary schema, the one Mehmet Ince's write-up uses: only the update fixes the flaw.

## Checking the mitigation

```bash theme={null}
# The running version must be 18.7, 17.12, 16.16, 15.20 or 14.25 (or later)
sudo -u postgres psql -c 'SHOW server_version;'

# Installed package
apt policy postgresql-17          # Debian, Ubuntu (adjust the branch)
rpm -qa 'postgresql*-server'      # RHEL, AlmaLinux

# Docker: image version inside the container
docker compose exec <service> postgres --version
```

An up-to-date package with an old `server_version` means PostgreSQL was not restarted.

## Reverting the mitigation

Once the fixed version is running, give the create privilege back to the roles that need it, and only those:

```sql theme={null}
-- Grant the create privilege to the application's role
GRANT CREATE ON SCHEMA public TO <application_role>;
```

If you removed the PostgreSQL service from firewalld's public zone and hosts outside the `trusted` zone must connect:

```bash theme={null}
sudo firewall-cmd --permanent --add-service=postgresql
sudo firewall-cmd --reload
```

## What next?

A PostgreSQL server does not need to be reachable from the whole Internet: keep port 5432 for the hosts that need it, and give each application a role limited to its own database. Turn on [automatic security updates](https://blog.onetsolutions.net/en/automatic-security-updates-linux-vps.md) and [back up your databases](https://blog.onetsolutions.net/en/backup-linux-vps-restic-files-databases.md) too. For another recent flaw, read [the WordPress flaw CVE-2026-119977](https://blog.onetsolutions.net/en/wordpress-upgrade-race-cve-2026-119977.md). For any technical question, open a ticket from your [OnetSolutions customer area](https://help.onetsolutions.net/console/support).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.