CVE-2022-31197

Summary

CVECVE-2022-31197
StatePUBLIC
Assigner[email protected]
Source PriorityCVE Program / NVD first with legacy fallback
Published2022-08-03 19:15:00 UTC
Updated2023-11-07 03:47:00 UTC
DescriptionPostgreSQL 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.

Risk And Classification

Problem Types: CWE-89

NVD Known Affected Configurations (CPE 2.3)

TypeVendorProductVersionUpdateEditionLanguage
Operating System Debian Debian Linux 10.0 All All All
Operating System Fedoraproject Fedora 35 All All All
Operating System Fedoraproject Fedora 36 All All All
Application Postgresql Postgresql Jdbc Driver All All All All
Application Postgresql Postgresql Jdbc Driver 42.4.0 - All All
Application Postgresql Postgresql Jdbc Driver 42.4.0 rc1 All All
Application Postgresql Postgresql Jdbc Driver 42.4.1 rc1 All All

References

ReferenceSourceLinkTags
[SECURITY] Fedora 36 Update: postgresql-jdbc-42.3.1-4.fc36 - package-announce - Fedora Mailing-Lists FEDORA lists.fedoraproject.org
[SECURITY] Fedora 35 Update: postgresql-jdbc-42.2.26-1.fc35 - package-announce - Fedora Mailing-Lists FEDORA lists.fedoraproject.org
SQL Injection in ResultSet.refreshRow() with malicious column names · Advisory · pgjdbc/pgjdbc · GitHub CONFIRM github.com
[SECURITY] Fedora 35 Update: postgresql-jdbc-42.2.26-1.fc35 - package-announce - Fedora Mailing-Lists lists.fedoraproject.org
[SECURITY] [DLA 3140-1] libpgjava security update MLIST lists.debian.org
[SECURITY] Fedora 36 Update: postgresql-jdbc-42.3.1-4.fc36 - package-announce - Fedora Mailing-Lists lists.fedoraproject.org
Merge pull request from GHSA-r38f-c4h4-hqq2 · pgjdbc/pgjdbc@739e599 · GitHub MISC github.com
CVE Program record CVE.ORG www.cve.org canonical
NVD vulnerability detail NVD nvd.nist.gov canonical, analysis

Legacy QID Mappings

  • 160431 Oracle Enterprise Linux Security Update for postgresql-jdbc (ELSA-2023-0318)
  • 181118 Debian Security Update for libpgjava (DLA 3140-1)
  • 183540 Debian Security Update for libpgjava (CVE-2022-31197)
  • 241119 Red Hat Update for postgresql-jdbc (RHSA-2023:0318)
  • 283174 Fedora Security Update for postgresql (FEDORA-2022-d7d49b2fac)
  • 283175 Fedora Security Update for postgresql (FEDORA-2022-cdeabe1bc0)
  • 502490 Alpine Linux Security Update for java-postgresql-jdbc
  • 672416 EulerOS Security Update for postgresql-jdbc (EulerOS-SA-2022-2803)
  • 690940 Free Berkeley Software Distribution (FreeBSD) Security Update for puppetdb (aeb4c85b-3600-11ed-b52d-589cfc007716)
  • 752659 SUSE Enterprise Linux Security Update for postgresql-jdbc (SUSE-SU-2022:3541-1)
  • 753226 SUSE Enterprise Linux Security Update for postgresql-jdbc (SUSE-SU-2022:3537-1)
  • 753484 SUSE Enterprise Linux Security Update for postgresql-jdbc (SUSE-SU-2022:3613-1)
  • 940900 AlmaLinux Security Update for postgresql-jdbc (ALSA-2023:0318)
  • 960492 Rocky Linux Security Update for postgresql-jdbc (RLSA-2023:0318)
© CVE.report 2026 |

Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. It is the responsibility of user to evaluate the accuracy, completeness or usefulness of any information, opinion, advice or other content. EACH USER WILL BE SOLELY RESPONSIBLE FOR ANY consequences of his or her direct or indirect use of this web site. ALL WARRANTIES OF ANY KIND ARE EXPRESSLY DISCLAIMED. This site will NOT BE LIABLE FOR ANY DIRECT, INDIRECT or any other kind of loss.

CVE, CWE, and OVAL are registred trademarks of The MITRE Corporation and the authoritative source of CVE content is MITRE's CVE web site. This site includes MITRE data granted under the following license.

Free CVE JSON API cve.report/api

CVE.report and Source URL Uptime Status status.cve.report