CVE-2023-39417 Postgresql: extension script @substitutions@ within quoting allow sql injection
Attackers with CREATE privileges can execute arbitrary code as superuser via SQL injection in vulnerable extension scripts using specific quoting constructs.
- 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-2023-39417?
CVE-2023-39417 is a high-severity SQL injection vulnerability in Debian Debian Linux, published on 11 Aug 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Official description
IN THE EXTENSION SCRIPT, a SQL Injection vulnerability was found in PostgreSQL if it uses @extowner@, @extschema@, or @extschema:...@ inside a quoting construct (dollar quoting, '', or ""). If an administrator has installed files of a vulnerable, trusted, non-bundled extension, an attacker with database-level CREATE privilege can execute arbitrary code as the bootstrap superuser.
Weakness: CWE-89
Which versions are affected by CVE-2023-39417?
1 open source package ship an affected version, including postgresql. It affects 4 products.
| Package | Affected | Fixed in |
|---|---|---|
postgresql Bitnami | From 11.0.0 | 11.21.0, 12.16.0, 13.12.0, 14.9.0, 15.4.0 |
Linux distribution packages (32)
postgresql12 SUSE:Linux Enterprise High Performance Computing 15 SP1-LTSS | All versions | 12.16-150100.3.44.1 |
postgresql14 SUSE:Linux Enterprise Module for Basesystem 15 SP4 | All versions | 14.9-150200.5.29.1 |
postgresql13 SUSE:Linux Enterprise Module for Legacy 15 SP4 | All versions | 13.12-150200.5.43.1 |
postgresql14 SUSE:Linux Enterprise Module for Legacy 15 SP5 | All versions | 14.9-150200.5.29.1 |
postgresql14 SUSE:Linux Enterprise Module for Package Hub 15 SP4 | All versions | 14.9-150200.5.29.1 |
postgresql14 SUSE:Linux Enterprise Module for Package Hub 15 SP5 | All versions | 14.9-150200.5.29.1 |
postgresql14 SUSE:Linux Enterprise Module for Server Applications 15 SP4 | All versions | 14.9-150200.5.29.1 |
postgresql12 SUSE:Linux Enterprise Server 12 SP5 | All versions | 12.16-3.42.1 |
postgresql13 SUSE:Linux Enterprise Server 12 SP5 | All versions | 13.12-3.36.1 |
postgresql14 SUSE:Linux Enterprise Server 12 SP5 | All versions | 14.9-3.26.1 |
postgresql12 SUSE:Linux Enterprise Server 15 SP1-LTSS | All versions | 12.16-150100.3.44.1 |
postgresql12 SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 12.16-3.42.1 |
postgresql13 SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 13.12-3.36.1 |
postgresql14 SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | All versions | 14.9-3.26.1 |
postgresql12 SUSE:Linux Enterprise Server for SAP Applications 15 SP1 | All versions | 12.16-150100.3.44.1 |
postgresql12 SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 12.16-3.42.1 |
postgresql13 SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 13.12-3.36.1 |
postgresql14 SUSE:Linux Enterprise Software Development Kit 12 SP5 | All versions | 14.9-3.26.1 |
postgresql13 SUSE:Manager Proxy 4.2 | All versions | 13.12-150200.5.43.1 |
postgresql14 SUSE:Manager Proxy 4.2 | All versions | 14.9-150200.5.29.1 |
postgresql13 SUSE:Manager Server 4.2 | All versions | 13.12-150200.5.43.1 |
postgresql14 SUSE:Manager Server 4.2 | All versions | 14.9-150200.5.29.1 |
postgresql12 openSUSE:Leap 15.4 | All versions | 12.16-150200.8.47.1 |
postgresql13 openSUSE:Leap 15.4 | All versions | 13.12-150200.5.43.1 |
postgresql14 openSUSE:Leap 15.4 | All versions | 14.9-150200.5.29.1 |
postgresql12 openSUSE:Leap 15.5 | All versions | 12.16-150200.8.47.1 |
postgresql13 openSUSE:Leap 15.5 | All versions | 13.12-150200.5.43.1 |
postgresql14 openSUSE:Leap 15.5 | All versions | 14.9-150200.5.29.1 |
postgresql11 openSUSE:Tumbleweed | All versions | 11.21-1.1 |
postgresql12 openSUSE:Tumbleweed | All versions | 12.16-1.1 |
postgresql13 openSUSE:Tumbleweed | All versions | 13.12-1.1 |
postgresql14 openSUSE:Tumbleweed | All versions | 14.9-1.1 |
Products include Debian Debian Linux, Postgresql Postgresql, Redhat Enterprise Linux, Redhat Software Collections.
How do I fix CVE-2023-39417?
Upgrade postgresql to a fixed version for your release line: 11.21.0, 12.16.0, 13.12.0 or 14.9.0.
Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.
Is CVE-2023-39417 being exploited?
There is no known exploitation of CVE-2023-39417 in the wild and no public exploit code.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as ALPINE-CVE-2023-39417, AZL-27892, BIT-postgresql-2023-39417, CLEANSTART-2026-JQ15135, CLSA-2023-1695319921, CLSA-2023-1696537563 and 23 more.