Skip to content
OpenAdvisories

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

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

ReleasePackageFixed inAdvisory
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
ReleasePackageFixed inAdvisory
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)
ReleasePackageFixed inAdvisory
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 —
ReleasePackageFixed inAdvisory
RHEL 9 postgresql-jdbc 42.2.18-6.el9_1 RHSA-2023:0318

AlmaLinux

Errata ↗
ReleasePackageFixed inAdvisory
AlmaLinux 9 postgresql-jdbc 42.2.18-6.el9_1 ALSA-2023:0318

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 9 postgresql-jdbc 42.2.18-6.el9_1 RLSA-2023:0318
ReleasePackageFixed inAdvisory
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)
ReleasePackageFixed inAdvisory
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
ReleasePackageFixed inAdvisory
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
ReleasePackageFixed inAdvisory
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)
ReleasePackageFixed inAdvisory
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

ReleasePackageFixed inAdvisory
Oracle Linux 9 postgresql-jdbc 42.2.18-6.el9_1 ELSA-2023-0318

Wolfi

ReleasePackageFixed inAdvisory
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

EcosystemPackageAffectedFixedRecord
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

References