Description
PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| pgjdbc | pgjdbc | >= 42.2.0, < 42.2.26, >= 42.3.0, < 42.4.1 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | libpgjava | 42.4.1-1 | — |
| Debian 13 | libpgjava | 42.4.1-1 | — |
| Debian 12 | libpgjava | 42.4.1-1 | — |
| Debian 11 | libpgjava | 42.2.15-1+deb11u2 | DLA-3995-1 |
| Debian 10 | libpgjava | 42.2.5-2+deb10u2 | DLA-3140-1 |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | libpgjava | No fix yet | — |
| Ubuntu 26.04 LTS | libpgjava | No fix yet | — |
| Ubuntu 25.10 | libpgjava | No fix yet | — |
| Ubuntu 24.04 LTS | libpgjava | No fix yet | — |
| Ubuntu 22.04 LTS | libpgjava | No fix yet | — |
Show 4 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 16.04 LTS | libpgjava | No fix yet | — |
| Ubuntu 14.04 LTS | libpgjava | No fix yet | — |
| Ubuntu Pro 20.04 LTS | libpgjava | No fix yet | — |
| Ubuntu Pro 18.04 LTS | libpgjava | No fix yet | — |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| RHEL 9 | postgresql-jdbc | 42.2.18-6.el9_1 | RHSA-2023:0318 |
AlmaLinux
Errata ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| AlmaLinux 9 | postgresql-jdbc | 42.2.18-6.el9_1 | ALSA-2023:0318 |
Rocky Linux
Errata ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Rocky Linux 9 | postgresql-jdbc | 42.2.18-6.el9_1 | RLSA-2023:0318 |
SUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 15 SP4 | postgresql-jdbc | 42.2.25-150400.3.6.1 | SUSE-SU-2022:3537-1 |
| SLES 15 SP3 | postgresql-jdbc | 42.2.25-150300.3.8.1 | SUSE-SU-2022:3613-1 |
| SLES 12 SP5 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SLES 12 SP4 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SLES 12 SP3 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
Show 7 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| SLES 12 SP2 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SLES for SAP 12 SP5 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SLES for SAP 12 SP4 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SUSE OpenStack Cloud Crowbar 9 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SUSE OpenStack Cloud 9 | postgresql-jdbc | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SUSE Manager Server Module 4.2 | postgresql-jdbc | 42.2.25-150300.3.8.1 | SUSE-SU-2022:3613-1 |
| SUSE Manager Server Module 4.1 | postgresql-jdbc | 42.2.10-150200.3.11.1 | SUSE-SU-2022:3705-1 |
openSUSE
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| openSUSE Leap 15.4 | postgresql-jdbc | 42.2.25-150400.3.6.1 | SUSE-SU-2022:3537-1 |
| openSUSE Leap 15.3 | postgresql-jdbc | 42.2.25-150300.3.8.1 | SUSE-SU-2022:3613-1 |
Alpine
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.24 | java-postgresql-jdbc | 42.4.2-r0 | — |
| Alpine v3.23 | java-postgresql-jdbc | 42.4.2-r0 | — |
| Alpine v3.22 | java-postgresql-jdbc | 42.4.2-r0 | — |
| Alpine v3.21 | java-postgresql-jdbc | 42.4.2-r0 | — |
| Alpine v3.20 | java-postgresql-jdbc | 42.4.2-r0 | — |
Show 4 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Alpine v3.19 | java-postgresql-jdbc | 42.4.2-r0 | — |
| Alpine v3.18 | java-postgresql-jdbc | 42.4.2-r0 | — |
| Alpine v3.17 | java-postgresql-jdbc | 42.4.2-r0 | — |
| Alpine v3.16 | java-postgresql-jdbc | 42.4.2-r0 | — |
Oracle Linux
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Oracle Linux 9 | postgresql-jdbc | 42.2.18-6.el9_1 | ELSA-2023-0318 |
Wolfi
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Wolfi rolling | mariadb-10.11 +7 | 10.11.8-r2 | — |
| Wolfi rolling | mariadb-10.6 +7 | 10.6.18-r2 | — |
| Wolfi rolling | mariadb-11.2 +7 | 11.2.3-r2 | — |
Affected packages
| Ecosystem | Package | Affected | Fixed | Record |
|---|---|---|---|---|
| Maven | org.postgresql:postgresql | < 42.2.26 | 42.2.26 | GHSA-r38f-c4h4-hqq2 |
| Maven | org.postgresql:postgresql | >= 42.4.0, < 42.4.1 | 42.4.1 | GHSA-r38f-c4h4-hqq2 |
| Maven | org.postgresql:postgresql | >= 42.3.0, < 42.3.7 | 42.3.7 | GHSA-r38f-c4h4-hqq2 |
Advisories 13
- ALSA-2023:0318 Moderate: postgresql-jdbc security update AlmaLinux Security Advisories · Oct 29, 2026
- RHSA-2023:0318 Red Hat Security Advisory: postgresql-jdbc security update Red Hat Security Advisories (RHSA) · Oct 2, 2026
- DLA-3140-1 libpgjava - security update Debian Security (DSA / DLA) · Mar 9, 2026
- DLA-3995-1 libpgjava - security update Debian Security (DSA / DLA) · Mar 9, 2026
- RLSA-2023:0318 Moderate: postgresql-jdbc security update Rocky Linux Security Advisories · Feb 4, 2026
- SUSE-SU-2022:3613-1 Security update for postgresql-jdbc SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2022:3541-1 Security update for postgresql-jdbc SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2022:3705-1 Security update for postgresql-jdbc SUSE / openSUSE Security Updates · Feb 4, 2026
- SUSE-SU-2022:3537-1 Security update for postgresql-jdbc SUSE / openSUSE Security Updates · Feb 4, 2026
- WID-SEC-2022-0910 PostgreSQL JDBC Treiber: Schwachstelle ermöglicht SQL Injection BSI CERT-Bund (WID) · Nov 9, 2025
- WID-SEC-2023-0809 IBM QRadar SIEM: Mehrere Schwachstellen BSI CERT-Bund (WID) · Feb 19, 2024
- WID-SEC-2023-1807 Oracle Fusion Middleware: Mehrere Schwachstellen BSI CERT-Bund (WID) · Dec 26, 2023
- ELSA-2023-0318 Moderate: postgresql-jdbc security update (Oracle Linux 9) Oracle Linux Security Advisories (ELSA) · Jan 24, 2023
References
- https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2
- https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637
- FEDORA-2022-d7d49b2fac vendor-advisory
- FEDORA-2022-cdeabe1bc0 vendor-advisory
- [debian-lts-announce] 20221008 [SECURITY] [DLA 3140-1] libpgjava security update mailing-list