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

High 8.1 Published Updated

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

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

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

Which versions are affected by CVE-2025-1094?

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

PackageAffectedFixed in
postgresql BitnamiAll versions13.19.0, 14.16.0, 15.11.0, 16.7.0, 17.3.0
Linux distribution packages (39)
libpq AlmaLinux:8All versions13.20-1.el8_10
libpq-devel AlmaLinux:8All versions13.20-1.el8_10
pg_repack AlmaLinux:8All versions1.4.6-3.module_el8.6.0+2760+1746ec94
pg_repack AlmaLinux:8All versions1.4.6-3.module_el8.9.0+3704+f1f917ce
pg_repack AlmaLinux:8All versions1.4.6-3.module_el8.9.0+3704+f1f917ce
pg_repack AlmaLinux:8All versions1.4.8-1.module_el8.10.0+3798+606ebb9f
pg_repack AlmaLinux:8All versions1.4.8-1.module_el8.9.0+3706+885c732e
pg_repack AlmaLinux:8All versions1.5.1-1.module_el8.10.0+3930+ecf33554
pgaudit AlmaLinux:8All versions1.4.0-7.module_el8.10.0+3889+48cb11fb.alma.1
pgaudit AlmaLinux:8All versions1.4.0-7.module_el8.9.0+3740+0e74851f.alma.1
pgaudit AlmaLinux:8All versions1.5.0-1.module_el8.6.0+2760+1746ec94
pgaudit AlmaLinux:8All versions1.5.0-1.module_el8.6.0+3095+ee60d910
pgaudit AlmaLinux:8All versions1.7.0-1.module_el8.9.0+3706+885c732e
pgaudit AlmaLinux:8All versions16.0-1.module_el8.10.0+3798+606ebb9f
postgres-decoderbufs AlmaLinux:8All versions0.10.0-2.module_el8.6.0+2760+1746ec94
postgres-decoderbufs AlmaLinux:8All versions0.10.0-2.module_el8.6.0+3095+ee60d910
postgres-decoderbufs AlmaLinux:8All versions0.10.0-2.module_el8.9.0+3704+f1f917ce
postgres-decoderbufs AlmaLinux:8All versions0.10.0-2.module_el8.9.0+3704+f1f917ce
postgres-decoderbufs AlmaLinux:8All versions1.9.7-1.Final.module_el8.9.0+3706+885c732e
postgres-decoderbufs AlmaLinux:8All versions2.4.0-1.Final.module_el8.10.0+3798+606ebb9f
postgresql AlmaLinux:8All versions12.22-3.module_el8.10.0+3971+15b81305
postgresql AlmaLinux:8All versions13.20-1.module_el8.10.0+3967+334cd65a
postgresql AlmaLinux:8All versions15.12-1.module_el8.10.0+3968+5ca3d05a
postgresql AlmaLinux:8All versions16.8-1.module_el8.10.0+3969+2c3c9353
postgresql-contrib AlmaLinux:8All versions12.22-3.module_el8.10.0+3971+15b81305
postgresql-contrib AlmaLinux:8All versions13.20-1.module_el8.10.0+3967+334cd65a
postgresql-contrib AlmaLinux:8All versions15.12-1.module_el8.10.0+3968+5ca3d05a
postgresql-contrib AlmaLinux:8All versions16.8-1.module_el8.10.0+3969+2c3c9353
postgresql-docs AlmaLinux:8All versions12.22-3.module_el8.10.0+3971+15b81305
postgresql-docs AlmaLinux:8All versions13.20-1.module_el8.10.0+3967+334cd65a
postgresql-docs AlmaLinux:8All versions15.12-1.module_el8.10.0+3968+5ca3d05a
postgresql-docs AlmaLinux:8All versions16.8-1.module_el8.10.0+3969+2c3c9353
postgresql-plperl AlmaLinux:8All versions12.22-3.module_el8.10.0+3971+15b81305
postgresql-plperl AlmaLinux:8All versions13.20-1.module_el8.10.0+3967+334cd65a
postgresql-plperl AlmaLinux:8All versions15.12-1.module_el8.10.0+3968+5ca3d05a
postgresql-plperl AlmaLinux:8All versions16.8-1.module_el8.10.0+3969+2c3c9353
postgresql-plpython3 AlmaLinux:8All versions12.22-3.module_el8.10.0+3971+15b81305
postgresql-plpython3 AlmaLinux:8All versions13.20-1.module_el8.10.0+3967+334cd65a
postgresql-plpython3 AlmaLinux:8All versions15.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.

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-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: 1 Metasploit module and 6 proofs of concept on GitHub.

Sources

Also known as ALPINE-CVE-2025-1094, ALSA-2025:1736, ALSA-2025:1737, ALSA-2025:1738, ALSA-2025:1739, ALSA-2025:1740 and 98 more.

Is CVE-2025-1094 in your software?

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

Check your SBOMs for free