CVE-2022-31197
published high CVSS 3.1 · 7.1SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| pgjdbc | — | pgjdbc>= 42.2.0, < 42.2.26 · >= 42.3.0, < 42.4.1 | Affected | Not stated | GitHub_M |
| AlmaLinux | 9 | postgresql-jdbc | Advisory build | 42.2.18-6.el9_1 | ALSA-2023:0318 |
| Alpine Linux | edge | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Debian | bullseye | libpgjava | Advisory build | 42.2.15-1+deb11u2 | DLA-3995-1 |
| Oracle Linux | 9 | postgresql-jdbcaarch64 | Advisory build | 0:42.2.18-6.el9_1 | ELSA-2023-0318 |
| Red Hat Enterprise Linux | RHEL-9 | postgresql-jdbcnoarch | Advisory build | 42.2.18-6.el9_1 | RHSA-2023:0318 |
| SUSE / openSUSE | SLE-12-SP2 | postgresql-jdbcnoarch | Advisory build | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| Rocky Linux | 9 | postgresql-jdbcnoarch | Listed in advisory | Not stated | RLSA-2023:0318 |
Show 30 more entries
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Alpine Linux | v3.16 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.17 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.18 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.19 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.20 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.21 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.22 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.23 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Alpine Linux | v3.24 | java-postgresql-jdbc | Fixed | 42.4.2-r0 | Package fix record |
| Debian | buster | libpgjava | Advisory build | 42.2.5-2+deb10u2 | DLA-3140-1 |
| Oracle Linux | 9 | postgresql-jdbcx86_64 | Advisory build | 0:42.2.18-6.el9_1 | ELSA-2023-0318 |
| Red Hat Enterprise Linux | RHEL-9 | postgresql-jdbcsrc | Advisory build | 42.2.18-6.el9_1 | RHSA-2023:0318 |
| SUSE / openSUSE | SLE-12-SP3 | postgresql-jdbcnoarch | Advisory build | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SUSE / openSUSE | SLE-12-SP4 | postgresql-jdbcnoarch | Advisory build | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SUSE / openSUSE | SLE-12-SP5 | postgresql-jdbcnoarch | Advisory build | 9.4-3.6.3 | SUSE-SU-2022:3541-1 |
| SUSE / openSUSE | SLE-15-SP3 | postgresql-jdbcnoarch | Advisory build | 42.2.25-150300.3.8.1 | SUSE-SU-2022:3613-1 |
| SUSE / openSUSE | SLE-15-SP4 | postgresql-jdbcnoarch | Advisory build | 42.2.25-150400.3.6.1 | SUSE-SU-2022:3537-1 |
| SUSE / openSUSE | openSUSE-Leap-15.3 | postgresql-jdbcnoarch | Advisory build | 42.2.25-150300.3.8.1 | SUSE-SU-2022:3613-1 |
| SUSE / openSUSE | openSUSE-Leap-15.3 | postgresql-jdbc-javadocnoarch | Advisory build | 42.2.25-150300.3.8.1 | SUSE-SU-2022:3613-1 |
| SUSE / openSUSE | openSUSE-Leap-15.4 | postgresql-jdbcnoarch | Advisory build | 42.2.25-150400.3.6.1 | SUSE-SU-2022:3537-1 |
| SUSE / openSUSE | openSUSE-Leap-15.4 | postgresql-jdbc-javadocnoarch | Advisory build | 42.2.25-150400.3.6.1 | SUSE-SU-2022:3537-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbcaarch64 | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbcppc64le | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbcs390x | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbcx86_64 | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbc-javadocaarch64 | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbc-javadocppc64le | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbc-javadocs390x | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| SUSE / openSUSE | openSUSE-Tumbleweed | postgresql-jdbc-javadocx86_64 | Advisory build | 42.2.25-3.1 | OPENSUSE-SU-2024:12369-1 |
| Rocky Linux | 9 | postgresql-jdbcsrc | Listed in advisory | Not stated | RLSA-2023:0318 |
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.1 / 10
- Severity
- high
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| pgjdbc | pgjdbc | >= 42.2.0, < 42.2.26 (affected)>= 42.3.0, < 42.4.1 (affected) | GitHub_M · cna |
Weaknesses
1- CWE-89 CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
References
6- https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637
- https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2
- [debian-lts-announce] 20221008 [SECURITY] [DLA 3140-1] libpgjava security update https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html
- https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html
- FEDORA-2022-d7d49b2fac https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/
- FEDORA-2022-cdeabe1bc0 https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/
Provider assertions
3GitHub_M · cna
SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc
CISA-ADP · adp
CISA ADP Vulnrichment
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- ba8738a66a43c6238da9057d7a0ed0a5a6737e4b2b6373a42ecac27aa7a0a690
- Ingested
- 23 Sep 2026, 08:00:25 UTC
- Source record
- Official CVE record