# 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.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Aug 2023
- **Updated:** 30 Sep 2026
- **Also known as:** ALPINE-CVE-2023-39417, AZL-27892, BIT-postgresql-2023-39417, CLEANSTART-2026-JQ15135, CLSA-2023-1695319921, CLSA-2023-1696537563, DEBIAN-CVE-2023-39417, DLA-3600-1, ECHO-3bd5-11a7-75a6, GHSA-jx3x-j983-74m3, JLSEC-2026-42, OESA-2023-1576, OESA-2023-1577, OESA-2023-1578, SUSE-SU-2023:3341-1, SUSE-SU-2023:3343-1, SUSE-SU-2023:3344-1, SUSE-SU-2023:3344-2, SUSE-SU-2023:3345-1, SUSE-SU-2023:3346-1, SUSE-SU-2023:3348-1, SUSE-SU-2023:3384-1, UBUNTU-CVE-2023-39417, USN-6296-1, USN-6366-1, openSUSE-SU-2024:13118-1, openSUSE-SU-2024:13119-1, openSUSE-SU-2024:13120-1, openSUSE-SU-2024:13358-1

## 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 (Improper Neutralization of Special Elements used in an SQL Command)

## Which versions are affected by CVE-2023-39417?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `postgresql` | Bitnami | From 11.0.0 | 11.21.0, 12.16.0, 13.12.0, 14.9.0, 15.4.0 |
| `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: 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.

## 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

- [CVE-2015-3306](https://insights.sbomify.com/CVE-2015-3306/): ProFTPD Improper Access Control (critical 10.0, exploited in the wild)
- [CVE-2025-49113](https://insights.sbomify.com/CVE-2025-49113/): RoundCube Webmail Deserialization of Untrusted Data (critical 9.9, exploited in the wild)
- [CVE-2026-24061](https://insights.sbomify.com/CVE-2026-24061/): GNU InetUtils Argument Injection (critical 9.8, exploited in the wild)
- [CVE-2025-39682](https://insights.sbomify.com/CVE-2025-39682/): Linux Kernel Improper Check for Unusual or Exceptional Conditions (critical 9.8, exploited in the wild)
- [CVE-2024-9680](https://insights.sbomify.com/CVE-2024-9680/): Mozilla Firefox Use-After-Free (critical 9.8, exploited in the wild)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-39417 and fix it if it is affected.

What it is: 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.
Exploitation: There is no known exploitation of CVE-2023-39417 in the wild and no public exploit code.

Affected packages and fixed versions:
- postgresql (Bitnami): affected from 11.0.0; fixed in 11.21.0, 12.16.0, 13.12.0, 14.9.0, 15.4.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2023-39417/ (Markdown: https://insights.sbomify.com/CVE-2023-39417/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2023-39417
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2023-39417
- OSV: https://osv.dev/vulnerability/CVE-2023-39417

---
From sbomify Insights: https://insights.sbomify.com/CVE-2023-39417/
Summaries are generated and may contain mistakes; the official description above is the record.
