CVE-2026-16239 PostgreSQL type confusion in cursor CLOSE + DECLARE executes arbitrary code

High 8.8 Published Updated

A type confusion vulnerability in PostgreSQL cursor lifecycle allows authenticated users to execute arbitrary code as the database OS user.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-16239?

CVE-2026-16239 is a high-severity code injection vulnerability in Postgresql Postgresql, published on 13 Aug 2026. Any signed-in user can exploit it over the network, with no action from the victim.

Official description

Type confusion in PostgreSQL "portal"/cursor lifecycle allows a user to execute arbitrary code as the operating system user running the database, via re-creation of a cursor or other portal with different types. Versions before PostgreSQL 18.6, 17.11, 16.15, 15.19, and 14.24 are affected.

Weakness: CWE-843

Which versions are affected by CVE-2026-16239?

1 open source package ship an affected version, including postgresql. It affects 1 product.

PackageAffectedFixed in
postgresql BitnamiAll versions14.24.0, 15.19.0, 16.15.0, 17.11.0, 18.5.0

Products include Postgresql Postgresql.

How do I fix CVE-2026-16239?

Upgrade postgresql to a fixed version for your release line: 14.24.0, 15.19.0, 16.15.0 or 17.11.0.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-16239 being exploited?

There is no known exploitation of CVE-2026-16239 in the wild and no public exploit code.

All Postgresql Postgresql vulnerabilities

Sources

Also known as ALPINE-CVE-2026-16239, AZL-95717, BELL-CVE-2026-16239, BIT-postgresql-2026-16239, DEBIAN-CVE-2026-16239, ECHO-f2c3-3dd7-067b and 9 more.

Is CVE-2026-16239 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free