# CVE-2025-1094: PostgreSQL quoting APIs miss neutralizing quoting syntax in text that fails encoding validation

> Attackers can achieve SQL injection via improper quoting in libpq functions or CLI tools under specific encoding configurations, requiring upgrades.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 13 Feb 2025
- **Updated:** 14 Mar 2025
- **Also known as:** ALPINE-CVE-2025-1094, ALSA-2025:1736, ALSA-2025:1737, ALSA-2025:1738, ALSA-2025:1739, ALSA-2025:1740, ALSA-2025:1741, ALSA-2025:1742, ALSA-2025:1743, ALSA-2025:3082, AZL-56732, AZL-56791, BELL-CVE-2025-1094, BIT-postgresql-2025-1094, CLEANSTART-2026-ZC09647, CLSA-2025-1742471100, CLSA-2025-1742471210, CLSA-2025-1742924432, CLSA-2025-1761323193, CLSA-2025-1764858353, CLSA-2025-1764868292, DEBIAN-CVE-2025-1094, DLA-4052-1, DLA-4052-2, ECHO-0e2b-89cf-14bc, GHSA-mhw9-x46c-v6q4, MGASA-2025-0064, MINI-37m4-7jc9-882v, MINI-4jfr-pvvr-xx6h, MINI-jm43-hwm4-rgm8, MINI-w7m6-fc7p-6j27, MINI-xmrh-g664-jm25, OESA-2025-1152, OESA-2025-1153, OESA-2025-1154, OESA-2025-1155, OESA-2025-1227, OESA-2025-1228, OESA-2025-1229, OESA-2025-1230, RHSA-2025:1720, RHSA-2025:1721, RHSA-2025:1722, RHSA-2025:1723, RHSA-2025:1724, RHSA-2025:1725, RHSA-2025:1726, RHSA-2025:1727, RHSA-2025:1728, RHSA-2025:1729, RHSA-2025:1730, RHSA-2025:1731, RHSA-2025:1732, RHSA-2025:1733, RHSA-2025:1735, RHSA-2025:1736, RHSA-2025:1737, RHSA-2025:1738, RHSA-2025:1739, RHSA-2025:1740, RHSA-2025:1741, RHSA-2025:1742, RHSA-2025:1743, RHSA-2025:1744, RHSA-2025:1745, RHSA-2025:3050, RHSA-2025:3062, RHSA-2025:3063, RHSA-2025:3064, RHSA-2025:3082, RHSA-2025:3978, RLSA-2025:1736, RLSA-2025:1737, RLSA-2025:1738, RLSA-2025:1739, RLSA-2025:1740, RLSA-2025:1741, RLSA-2025:1742, RLSA-2025:1743, RLSA-2025:3082, SUSE-SU-2025:00614-1, SUSE-SU-2025:0606-1, SUSE-SU-2025:0614-1, SUSE-SU-2025:0615-1, SUSE-SU-2025:0616-1, SUSE-SU-2025:0618-1, SUSE-SU-2025:0619-1, SUSE-SU-2025:0631-1, SUSE-SU-2025:0632-1, SUSE-SU-2025:0633-1, SUSE-SU-2025:0634-1, SUSE-SU-2025:0635-1, SUSE-SU-2025:0636-1, SUSE-SU-2025:0637-1, SUSE-SU-2025:0655-1, SUSE-SU-2025:0737-1, UBUNTU-CVE-2025-1094, USN-7315-1, USN-7315-2, openSUSE-SU-2025:14805-1, openSUSE-SU-2025:14806-1, openSUSE-SU-2025:14807-1, openSUSE-SU-2025:14808-1, openSUSE-SU-2025:14810-1

## What is CVE-2025-1094?

CVE-2025-1094 is a high-severity SQL injection vulnerability in PostgreSQL, published on 13 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Improper neutralization of quoting syntax in PostgreSQL libpq functions PQescapeLiteral(), PQescapeIdentifier(), PQescapeString(), and PQescapeStringConn() allows a database input provider to achieve SQL injection in certain usage patterns.  Specifically, SQL injection requires the application to use the function result to construct input to psql, the PostgreSQL interactive terminal.  Similarly, improper neutralization of quoting syntax in PostgreSQL command line utility programs allows a source of command line arguments to achieve SQL injection when client_encoding is BIG5 and server_encoding is one of EUC_TW or MULE_INTERNAL.  Versions before PostgreSQL 17.3, 16.7, 15.11, 14.16, and 13.19 are affected.

Weakness: CWE-149 (Improper Neutralization of Quoting Syntax)

## Which versions are affected by CVE-2025-1094?

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `postgresql` | Bitnami | All versions | 13.19.0, 14.16.0, 15.11.0, 16.7.0, 17.3.0 |
| `libpq` | AlmaLinux:8 | All versions | 13.20-1.el8_10 |
| `libpq-devel` | AlmaLinux:8 | All versions | 13.20-1.el8_10 |
| `pg_repack` | AlmaLinux:8 | All versions | 1.4.6-3.module_el8.6.0+2760+1746ec94 |
| `pg_repack` | AlmaLinux:8 | All versions | 1.4.6-3.module_el8.9.0+3704+f1f917ce |
| `pg_repack` | AlmaLinux:8 | All versions | 1.4.6-3.module_el8.9.0+3704+f1f917ce |
| `pg_repack` | AlmaLinux:8 | All versions | 1.4.8-1.module_el8.10.0+3798+606ebb9f |
| `pg_repack` | AlmaLinux:8 | All versions | 1.4.8-1.module_el8.9.0+3706+885c732e |
| `pg_repack` | AlmaLinux:8 | All versions | 1.5.1-1.module_el8.10.0+3930+ecf33554 |
| `pgaudit` | AlmaLinux:8 | All versions | 1.4.0-7.module_el8.10.0+3889+48cb11fb.alma.1 |
| `pgaudit` | AlmaLinux:8 | All versions | 1.4.0-7.module_el8.9.0+3740+0e74851f.alma.1 |
| `pgaudit` | AlmaLinux:8 | All versions | 1.5.0-1.module_el8.6.0+2760+1746ec94 |
| `pgaudit` | AlmaLinux:8 | All versions | 1.5.0-1.module_el8.6.0+3095+ee60d910 |
| `pgaudit` | AlmaLinux:8 | All versions | 1.7.0-1.module_el8.9.0+3706+885c732e |
| `pgaudit` | AlmaLinux:8 | All versions | 16.0-1.module_el8.10.0+3798+606ebb9f |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 0.10.0-2.module_el8.6.0+2760+1746ec94 |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 0.10.0-2.module_el8.6.0+3095+ee60d910 |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 0.10.0-2.module_el8.9.0+3704+f1f917ce |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 0.10.0-2.module_el8.9.0+3704+f1f917ce |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 1.9.7-1.Final.module_el8.9.0+3706+885c732e |
| `postgres-decoderbufs` | AlmaLinux:8 | All versions | 2.4.0-1.Final.module_el8.10.0+3798+606ebb9f |
| `postgresql` | AlmaLinux:8 | All versions | 12.22-3.module_el8.10.0+3971+15b81305 |
| `postgresql` | AlmaLinux:8 | All versions | 13.20-1.module_el8.10.0+3967+334cd65a |
| `postgresql` | AlmaLinux:8 | All versions | 15.12-1.module_el8.10.0+3968+5ca3d05a |
| `postgresql` | AlmaLinux:8 | All versions | 16.8-1.module_el8.10.0+3969+2c3c9353 |
| `postgresql-contrib` | AlmaLinux:8 | All versions | 12.22-3.module_el8.10.0+3971+15b81305 |
| `postgresql-contrib` | AlmaLinux:8 | All versions | 13.20-1.module_el8.10.0+3967+334cd65a |
| `postgresql-contrib` | AlmaLinux:8 | All versions | 15.12-1.module_el8.10.0+3968+5ca3d05a |
| `postgresql-contrib` | AlmaLinux:8 | All versions | 16.8-1.module_el8.10.0+3969+2c3c9353 |
| `postgresql-docs` | AlmaLinux:8 | All versions | 12.22-3.module_el8.10.0+3971+15b81305 |
| `postgresql-docs` | AlmaLinux:8 | All versions | 13.20-1.module_el8.10.0+3967+334cd65a |
| `postgresql-docs` | AlmaLinux:8 | All versions | 15.12-1.module_el8.10.0+3968+5ca3d05a |
| `postgresql-docs` | AlmaLinux:8 | All versions | 16.8-1.module_el8.10.0+3969+2c3c9353 |
| `postgresql-plperl` | AlmaLinux:8 | All versions | 12.22-3.module_el8.10.0+3971+15b81305 |
| `postgresql-plperl` | AlmaLinux:8 | All versions | 13.20-1.module_el8.10.0+3967+334cd65a |
| `postgresql-plperl` | AlmaLinux:8 | All versions | 15.12-1.module_el8.10.0+3968+5ca3d05a |
| `postgresql-plperl` | AlmaLinux:8 | All versions | 16.8-1.module_el8.10.0+3969+2c3c9353 |
| `postgresql-plpython3` | AlmaLinux:8 | All versions | 12.22-3.module_el8.10.0+3971+15b81305 |
| `postgresql-plpython3` | AlmaLinux:8 | All versions | 13.20-1.module_el8.10.0+3967+334cd65a |
| `postgresql-plpython3` | AlmaLinux:8 | All versions | 15.12-1.module_el8.10.0+3968+5ca3d05a |

## How do I fix CVE-2025-1094?

Upgrade postgresql to a fixed version for your release line: 13.19.0, 14.16.0, 15.11.0 or 16.7.0.

## Is CVE-2025-1094 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-1094 exists.

Public exploit code:

- WebSocket and SQL Injection Exploit Script (github_poc): https://github.com/soltanali0/CVE-2025-1094-Exploit
- https://github.com/ishwardeepp/CVE-2025-1094-PoC-Postgre-SQLi (github_poc): https://github.com/ishwardeepp/CVE-2025-1094-PoC-Postgre-SQLi
- Unauthenticated RCE detector + RCA for BeyondTrust Remote Support / PRA (CVE-2024-12356 + CVE-2025-1094) (github_poc): https://github.com/skraft9/CVE-2024-12356
- It is an input sanitization flaw caused by an encoding mismatch, allowing crafted input to bypass filters. If a server is vulnerable, an attacker can inject malicious SQL that the backend executes. (github_poc): https://github.com/aninfosec/CVE-2025-1094
- BeyondTrust Privileged Remote Access (PRA) and Remote Support (RS) unauthenticated Remote Code Execution (metasploit)
- https://github.com/PinkArmor/CVE-2025-1094-Lab-Setup (github_poc): https://github.com/PinkArmor/CVE-2025-1094-Lab-Setup

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-1094 and fix it if it is affected.

What it is: CVE-2025-1094 is a high-severity SQL injection vulnerability in PostgreSQL, published on 13 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-1094 exists.

Affected packages and fixed versions:
- postgresql (Bitnami): affected all versions; fixed in 13.19.0, 14.16.0, 15.11.0, 16.7.0, 17.3.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-2025-1094/ (Markdown: https://insights.sbomify.com/CVE-2025-1094/index.md)
```

## Sources

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

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