CVEfocus › CVE database › CVE-2022-31197

CVE-2022-31197SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc

CVSS 7.1 HighEPSS 2.2% (higher than 83% of CVEs)Published 2022-08-03Updated 2025-11-03Assigner: GitHub_M

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.

CWE-89

What to do

Fixed builds are available from AlmaLinux, Alpine, Debian, Maven, Red Hat, Rocky Linux: see the table below for the fixed version per release.

Ubuntu has not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

16Fixed
3Fix pending
3Under investigation
179Will not fix
3Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 26.10libpgjavaFix pendingUBUNTU-CVE-2022-31197
Ubuntu 26.04libpgjavaUnder investigationUBUNTU-CVE-2022-31197
Ubuntu 25.10libpgjavaWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2022-31197
Ubuntu 24.04libpgjavaUnder investigationUBUNTU-CVE-2022-31197
Ubuntu 22.04libpgjavaUnder investigationUBUNTU-CVE-2022-31197
Ubuntu 20.04libpgjavaFix pendingUBUNTU-CVE-2022-31197
Ubuntu 18.04libpgjavaFix pendingUBUNTU-CVE-2022-31197
Ubuntu 16.04libpgjavaWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2022-31197
Ubuntu 14.04libpgjavaWill not fix
Ubuntu decided not to fix this in this release
UBUNTU-CVE-2022-31197
Debian 14libpgjavaFixed42.4.1-1DEBIAN-CVE-2022-31197
Debian 13libpgjavaFixed42.4.1-1DEBIAN-CVE-2022-31197
Debian 12libpgjavaFixed42.4.1-1DEBIAN-CVE-2022-31197
Red Hat Enterprise Linux 9postgresql-jdbcFixed0:42.2.18-6.el9_1RHSA-2023:0318
Red Hat Enterprise Linux 8autocorr-afWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-bgWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-caWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-csWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-daWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-deWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-elWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-enWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-esWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-faWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-fiWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-frWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-gaWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-hrWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-huWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-isWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-itWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-jaWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-koWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-lbWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-ltWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-mnWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-nlWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-plWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-ptWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-roWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-ruWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-skWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-slWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-srWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-svWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-trWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-viWill not fix
Will not fix
Red Hat Enterprise Linux 8autocorr-zhWill not fix
Will not fix
Red Hat Enterprise Linux 8libreofficeWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-baseWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-calcWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-coreWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-dataWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-drawWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-emailmergeWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-filtersWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-gdb-debug-supportWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-graphicfilterWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-gtk2Will not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-gtk3Will not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-arWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-bgWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-bnWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-caWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-csWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-daWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-deWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-dzWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-elWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-enWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-esWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-etWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-euWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-fiWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-frWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-glWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-guWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-heWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-hiWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-hrWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-huWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-idWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-itWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-jaWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-koWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-ltWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-lvWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-nbWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-nlWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-nnWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-plWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-pt-BRWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-pt-PTWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-roWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-ruWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-siWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-skWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-slWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-svWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-taWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-trWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-ukWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-zh-HansWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-help-zh-HantWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-impressWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-afWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-arWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-asWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-bgWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-bnWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-brWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-caWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-csWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-cyWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-daWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-deWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-dzWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-elWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-enWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-esWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-etWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-euWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-faWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-fiWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-frWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-gaWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-glWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-guWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-heWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-hiWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-hrWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-huWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-idWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-itWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-jaWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-kkWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-knWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-koWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-ltWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-lvWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-maiWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-mlWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-mrWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-nbWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-nlWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-nnWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-nrWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-nsoWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-orWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-paWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-plWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-pt-BRWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-pt-PTWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-roWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-ruWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-siWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-skWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-slWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-srWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-ssWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-stWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-svWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-taWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-teWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-thWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-tnWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-trWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-tsWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-ukWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-veWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-xhWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-zh-HansWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-zh-HantWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-langpack-zuWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-mathWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-ogltransWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-opensymbol-fontsWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-pdfimportWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-pyunoWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-sdkWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-sdk-docWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-ureWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-ure-commonWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-wiki-publisherWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-writerWill not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-x11Will not fix
Will not fix
Red Hat Enterprise Linux 8libreoffice-xsltfilterWill not fix
Will not fix
Red Hat Enterprise Linux 8libreofficekitWill not fix
Will not fix
Red Hat Enterprise Linux 8postgresql-jdbcWill not fix
Will not fix
Red Hat Enterprise Linux 8postgresql-jdbc-javadocWill not fix
Will not fix
Red Hat Enterprise Linux 7postgresql-jdbcNot affected
Red Hat Enterprise Linux 7postgresql-jdbc-javadocNot affected
Red Hat Enterprise Linux 6postgresql-jdbcNot affected
AlmaLinux 9postgresql-jdbcFixed42.2.18-6.el9_1ALSA-2023:0318
Rocky Linux 9postgresql-jdbcFixed0:42.2.18-6.el9_1RLSA-2023:0318
Alpine Linux 3.24java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.23java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.22java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.21java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.20java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.19java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.18java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.17java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Alpine Linux 3.16java-postgresql-jdbcFixed42.4.2-r0ALPINE-CVE-2022-31197
Maven libraryorg.postgresql:postgresqlFixed42.2.26GHSA-r38f-c4h4-hqq2

What the vendor says

As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

Vendor advisories:

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.