Vulnerability
CVE-2022-31197
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.
69 advisories report this vulnerability, across 13 ecosystems.
Advisories
-
ALPINE-CVE-2022-31197
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()`…
- ALPINE-EDGE-CVE-2022-31197
-
ALSA-2023:0318
Moderate: postgresql-jdbc security update
- CGA-35fq-3q9x-2xgr
- CGA-3766-6329-r925
- CGA-397g-95r7-c8vf
- CGA-3j2j-rv6v-g8hc
- CGA-3vfp-c8pq-98p3
- CGA-4495-r7v3-h8w4
- CGA-4crq-8v3w-g2j7
- CGA-65xj-cvxw-f25w
- CGA-69xg-vgxq-vf74
- CGA-6g8m-2xvf-gc4m
- CGA-72m9-c3h9-rf7q
- CGA-7qc9-pgmh-p35r
- CGA-89ff-pjm5-c2c3
- CGA-89pg-x4qp-hr64
- CGA-8wg4-h7jg-pxq4
- CGA-9j3w-cfr5-px8p
- CGA-c2gf-gx26-g2cv
- CGA-cxmw-7x96-wmwc
- CGA-f794-g8q2-xhhh
- CGA-fccr-3435-qv72
- CGA-fg4h-hf65-9phv
- CGA-fqm5-f9mh-mgcg
- CGA-fqv6-m5xf-9wf3
- CGA-fwrj-xww7-9cr7
- CGA-fxxj-v2vr-ww4p
- CGA-g6g6-g572-692w
- CGA-hcm4-fgpc-rxhf
- CGA-j7j2-p77w-cfq5
- CGA-jq9q-9rgp-cjjf
- CGA-m46m-p6m9-fqfj
- CGA-m6fg-fvx3-w64q
- CGA-m9wc-cvv3-2wr6
- CGA-mqm2-qhj2-q27q
- CGA-mwxq-86vf-h79h
- CGA-mxxw-9hq8-gqq2
- CGA-p45w-hp7r-g2rg
- CGA-prx8-hm2q-gjvc
- CGA-q3g9-5w84-xj4v
- CGA-qch5-3rw3-xjq6
- CGA-qh73-p2g4-4g2m
- CGA-v7hr-qpg9-6m9r
- CGA-vh92-j834-f49h
- CGA-vmv6-9c94-f2f9
- CGA-wfm2-v7mx-vgh6
- CGA-wjj7-9wvq-98hp
- CGA-wp8x-8h78-xcwq
- CGA-wwx3-m3wf-hjh4
- CGA-wx49-pr69-mg24
- CGA-xgpx-hcw5-grjj
- CGA-xj3j-rrm7-8mv4
- CGA-xmqc-xp64-32vj
-
DEBIAN-CVE-2022-31197
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()`…
-
DLA-3140-1
libpgjava - security update
-
DLA-3995-1
libpgjava - security update
-
ELSA-2023-0318
ELSA-2023-0318: postgresql-jdbc security update (MODERATE)
-
GHSA-r38f-c4h4-hqq2
PostgreSQL JDBC Driver SQL Injection in ResultSet.refreshRow() with malicious column names
-
OESA-2022-1835
postgresql-jdbc security update
-
RHSA-2023:0318
Red Hat Security Advisory: postgresql-jdbc security update
-
RHVEX-CVE-2022-31197
postgresql: SQL Injection in ResultSet.refreshRow() with malicious column names
-
RLSA-2023:0318
Moderate: postgresql-jdbc security update
-
SUSE-SU-2022:3537-1
Security update for postgresql-jdbc
-
SUSE-SU-2022:3541-1
Security update for postgresql-jdbc
-
SUSE-SU-2022:3613-1
Security update for postgresql-jdbc
-
SUSE-SU-2022:3705-1
Security update for postgresql-jdbc
-
SUSEVEX-CVE-2022-31197
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()`…
-
UBUNTU-CVE-2022-31197
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()`…
References
- https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637
- https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2
- https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/
- https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html