Security advisory · Server software

CVE-2023-39417: a vulnerability in PostgreSQL

Updated December 2, 2026By HostCrust2 min read

CVE-2023-39417: SQL injection in PostgreSQL extension script quoting allowed attackers with CREATE privilege to execute code as the bootstrap superuser when a vulnerable, trusted, non-bundled extension was installed. Prioritise any internet-facing service first. The affected versions, the fix and the CVSS score below come straight from the CVE record, not our interpretation.

CVE ID
CVE-2023-39417
Published
August 11, 2023
CVSS
8.8 (High), CVSS 3.1
Affected
from 11.0, 12.0, 13.0, 14.0 up to the fixed release
Fixed in
11.21, 12.16, 13.12, 14.9
Assigned by
Red Hat

What is CVE-2023-39417?

The vulnerability is a SQL injection in extension script processing: when PostgreSQL uses @extowner@, @extschema@, or @extschema:...@ inside a quoting construct (dollar quoting, single quotes, or double quotes), an attacker with database-level CREATE privilege can inject SQL that is interpreted during extension installation or use. The flaw arises in how those substitution tokens are handled inside quoted contexts, allowing crafted values to break out of the intended quoting and alter parsed SQL. The attack vector requires an administrator to have installed files of a vulnerable, trusted, non-bundled extension; the attacker only needs CREATE privilege in the database to exploit this condition. A successful exploit lets the attacker execute arbitrary code as the bootstrap superuser, resulting in full confidentiality, integrity, and availability compromise of the server. Affected releases are from 11.0, 12.0, 13.0, 14.0 up to the fixed release; fixed versions are 11.21, 12.16, 13.12, 14.9.

Am I affected?

Affected: PostgreSQL releases from 11.0, 12.0, 13.0, 14.0 up to the fixed release. Fixed in 11.21, 12.16, 13.12, 14.9.

How do I fix it?

Install your distribution's security update for this package, then restart the affected service so the running process picks up the fix.

# Debian / Ubuntu
sudo apt update && sudo apt upgrade

# RHEL / AlmaLinux / Rocky Linux
sudo dnf upgrade --refresh

How HostCrust helps you see it

Patch Proof checks the packages on each server against your distribution's own security data, per CVE, so once your distribution publishes its fix it shows this package as open until the update is installed — and because it is a running service, the fix isn't done until you restart it.

How we checked this: Every fact on this page — the CVE id, the affected and fixed versions, the CVSS score and the remediation — was taken from the CVE's NVD record and the vendor or CNA advisory linked under Sources, and checked on December 2, 2026. HostCrust did not independently reproduce the vulnerability. Anything we didn't run ourselves comes from the official documentation listed under Sources.

Check which CVEs are really open on your server

HostCrust Patch Proof compares every installed package with your distribution's own security data. It counts fixes your distro backported and checks the kernel that is actually running, not just the one on disk. Read-only, no root, free.

Run the free check About Patch Proof

FAQ

How severe is CVE-2023-39417?

The NVD record lists a CVSS base score of 8.8 (High) (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H). Severity scores can be revised as a CVE is analysed, so check the NVD record and the vendor advisory under Sources for the current figure.

How do I fix it?

Install your distribution's or vendor's fixed release for PostgreSQL and restart the affected service (or reboot, for a kernel fix). The commands are in the section above.

Where do these facts come from?

Every fact on this page — the CVE id, the affected and fixed versions, the CVSS score and the remediation — is copied from the CVE's NVD record and the vendor or CNA advisory linked under Sources. HostCrust reformats the official facts; it does not add its own.

Sources

  1. NVD: CVE-2023-39417
  2. Vendor advisory: www.postgresql.org
  3. Reference: access.redhat.com
  4. Reference: access.redhat.com
  5. Reference: access.redhat.com