CVE-2022-31197
A public proof of concept exists; no exploitation attested.
- Published2022-08-03
- Fixed in42.4.1 · 42.3.7 · 42.2.26
- WeaknessCWE-89
Am I affected?
Debian, Ubuntu or Red Hat sometimes backport a fix without changing the upstream version number: such a version reads « to verify », never « affected ».With a domain, we read the version its public headers and pages expose. A distribution build can carry the fix under an older number.
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.
Timeline
dates in UTC- 2022-08-0319:15CVE publishedNVD
Versions per branch
OSV · NVD| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 42.4 | ≥ 42.4.0, < 42.4.1 | 42.4.1 | OSV |
| 42.3 | ≥ 42.3.0, < 42.3.7 | 42.3.7 | NVD · OSV |
| 42.2 | < 42.2.26 | 42.2.26 | NVD · OSV |
| 42.4 | = 42.4.0 | no fix published | NVD |
| 42.4 | = 42.4.1 | no fix published | NVD |
| 42.4 | ≥ 42.4.0, ≤ 42.4.0 | no fix published | OSV |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 35.x | = 35 | no fix published | NVD |
| 36.x | = 36 | no fix published | NVD |
| Branch | Affected | Fixed in | Source |
|---|---|---|---|
| 10.0 | = 10.0 | no fix published | NVD |
as publishedRanges as NVD and OSV publish them; a distribution’s build can be fixed under an older number.
Products declared by the CNA1 product
As GitHub_M, the CNA that assigned this CVE, declared them in the CVE record; versions as written.
- pgjdbcAffected
- = >= 42.2.0, < 42.2.26no fix stated
- = >= 42.3.0, < 42.4.1no fix stated
Source: the CNA record (CVE Program), © The MITRE Corporation,CVE terms of useCVE recordupdated 2022-10-08
Distribution builds and vendor advisories
Packages from OSV.dev and products from the vendors' CSAF advisories.
version not verifiedVersions not verified: read as OSV.dev and the vendors publish them, not checked against each vendor's release list.
Packages
- apache-hiveCleanStartall versions · fixed in 3.1.3-r3
- java-postgresql-jdbcCleanStartall versions · fixed in 42.4.2-r0
- java-postgresql-jdbcAlpine:v3.25all versions · fixed in 42.4.2-r0
- java-postgresql-jdbcAlpine:v3.24all versions · fixed in 42.4.2-r0
- java-postgresql-jdbcAlpine:v3.23all versions · fixed in 42.4.2-r0
- java-postgresql-jdbcAlpine:v3.22all versions · fixed in 42.4.2-r0
- java-postgresql-jdbcAlpine:v3.21all versions · fixed in 42.4.2-r0
- java-postgresql-jdbcAlpine:v3.20all versions · fixed in 42.4.2-r0
46 more package ranges on OSV.dev
Vendor advisories
postgresql: SQL Injection in ResultSet.refreshRow() with malicious column names
quarkus-jdbc-postgresql-deployment as a component of Red Hat build of Apicurio Registry 2 · jdbc-postgresql as a component of Red Hat Decision Manager 7 · autocorr-af (libreoffice:flatpak) as a component of Red Hat Enterprise Linux 8 · +178 more
Red Hat Security Advisory: Red Hat build of Quarkus 2.7.7 release and security update
Red Hat Security Advisory: postgresql-jdbc security update
Red Hat Security Advisory: Red Hat build of Quarkus 2.13.5 release and security update
Red Hat Security Advisory: Red Hat Fuse 7.11.1 release and security update
Fix
- Update Postgresql postgresql jdbc driver to 42.4.1 · 42.3.7 · 42.2.26
- Vendor fix Red Hat Product Security RHSA-2023:1006 · 1 productBefore applying this update, make sure all previously released errata relevant to your system have been applied. For details on how to apply this update, refer to: https://access.redhat.com/articles/11258
- Vendor fix Red Hat Product Security RHSA-2023:0318 · 2 productsFor details on how to apply this update, which includes the changes described in this advisory, refer to: https://access.redhat.com/articles/11258 If the postgresql service is running, it will be automatically restarted after installing this update.
- Vendor fix Red Hat Product Security RHSA-2022:8652 · 1 productBefore applying the update, back up your existing installation, including all applications, configuration files, databases and database settings, and so on. Installation instructions are available from the Fuse 7.11.1 product documentation page: https://access.redhat.com/documentation/en-us/red_ha…
- No fix available, says the vendor Red Hat Product Security CVE-2022-31197 · 1 productAffected
- No fix planned, says the vendor Red Hat Product Security CVE-2022-31197 · 2 productsOut of support scope
- No fix planned, says the vendor Red Hat Product Security CVE-2022-31197 · 178 productsWill not fix
Advisories and patches
- github.comPatch
Detection
- Nuclei template
- none so far ProjectDiscovery
- Exploit-DB
- no entry Exploit-DB
- Proof of concept
- CISA-ADP (SSVC)PoC stated2025-04-22
- PoC-in-GitHubno public repository identifiedread 2026-12-04
- Metasploit modules
- none listed Metasploit Framework
Sources
- CISA-ADPSSVC decisionpoc2025-04-22
- CNACVSS 3.17.1known since 2026-10-23
- NVDCVSS 3.18read 2026-10-23
- CNAweakness (CWE)CWE-89known since 2026-10-23
- FIRST EPSSEPSS score2.4 %2026-12-04
- OSVaffected packages—
- GitHub AdvisoriesadvisoryHigh2022-08-06
Identifiers
- BIT-postgresql-jdbc-driver-2022-31197same flawBitnami · Apache-2.0
- CGA-35fq-3q9x-2xgrsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-3766-6329-r925same flawChainguard · CC-BY-NC-ND-4.0
- CGA-397g-95r7-c8vfsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-3j2j-rv6v-g8hcsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-3vfp-c8pq-98p3same flawChainguard · CC-BY-NC-ND-4.0
- CGA-4495-r7v3-h8w4same flawChainguard · CC-BY-NC-ND-4.0
- CGA-4crq-8v3w-g2j7same flawChainguard · CC-BY-NC-ND-4.0
- CGA-65xj-cvxw-f25wsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-69xg-vgxq-vf74same flawChainguard · CC-BY-NC-ND-4.0
- CGA-6g8m-2xvf-gc4msame flawChainguard · CC-BY-NC-ND-4.0
- CGA-72m9-c3h9-rf7qsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-7qc9-pgmh-p35rsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-89ff-pjm5-c2c3same flawChainguard · CC-BY-NC-ND-4.0
- CGA-89pg-x4qp-hr64same flawChainguard · CC-BY-NC-ND-4.0
- CGA-8wg4-h7jg-pxq4same flawChainguard · CC-BY-NC-ND-4.0
- CGA-9j3w-cfr5-px8psame flawChainguard · CC-BY-NC-ND-4.0
- CGA-c2gf-gx26-g2cvsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-cxmw-7x96-wmwcsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-f794-g8q2-xhhhsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-fccr-3435-qv72same flawChainguard · CC-BY-NC-ND-4.0
- CGA-fg4h-hf65-9phvsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-fqm5-f9mh-mgcgsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-fwrj-xww7-9cr7same flawChainguard · CC-BY-NC-ND-4.0
- CGA-fxxj-v2vr-ww4psame flawChainguard · CC-BY-NC-ND-4.0
- CGA-g6g6-g572-692wsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-hcm4-fgpc-rxhfsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-j7j2-p77w-cfq5same flawChainguard · CC-BY-NC-ND-4.0
- CGA-jq9q-9rgp-cjjfsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-m46m-p6m9-fqfjsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-m6fg-fvx3-w64qsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-m9wc-cvv3-2wr6same flawChainguard · CC-BY-NC-ND-4.0
- CGA-mqm2-qhj2-q27qsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-mwxq-86vf-h79hsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-mxxw-9hq8-gqq2same flawChainguard · CC-BY-NC-ND-4.0
- CGA-p45w-hp7r-g2rgsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-prx8-hm2q-gjvcsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-q3g9-5w84-xj4vsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-qch5-3rw3-xjq6same flawChainguard · CC-BY-NC-ND-4.0
- CGA-qh73-p2g4-4g2msame flawChainguard · CC-BY-NC-ND-4.0
- CGA-v7hr-qpg9-6m9rsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-vh92-j834-f49hsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-vmv6-9c94-f2f9same flawChainguard · CC-BY-NC-ND-4.0
- CGA-wfm2-v7mx-vgh6same flawChainguard · CC-BY-NC-ND-4.0
- CGA-wjj7-9wvq-98hpsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-wp8x-8h78-xcwqsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-wwx3-m3wf-hjh4same flawChainguard · CC-BY-NC-ND-4.0
- CGA-wx49-pr69-mg24same flawChainguard · CC-BY-NC-ND-4.0
- CGA-xgpx-hcw5-grjjsame flawChainguard · CC-BY-NC-ND-4.0
- CGA-xj3j-rrm7-8mv4same flawChainguard · CC-BY-NC-ND-4.0
Technical details
- CVSS v3 vector
- CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
- Published
- 2022-08-03
- Last modified
- 2026-06-17
- NVD status
- Modified
- GitHub advisory
- GHSA-r38f-c4h4-hqq2
Frequently asked questions
What is CVE-2022-31197?
Is CVE-2022-31197 actively exploited?
What is the CVSS score for CVE-2022-31197?
Running PostgreSQL? Hear about its next vulnerability
Surveillance reads the versions in your stack — a domain, a lockfile or a list — checks each CVE against the ranges its sources publish, and alerts you when one you run is exploited or enters CISA KEV. A version it cannot read stays « version not verified ».
No credit card required · No monthly cap on website checks · 250 API requests/month
Go further
- Following what attackers exploit right now? The CISA KEV additions of the month, with their patch deadlines.
- Running this software? Vulnerability monitoring alerts you to new vulnerabilities in your products.
Related vulnerabilities
Same product first, then the same vendor advisory and the same publication week.
- CVE-2024-1597same product
- CVE-2026-42198same product
- CVE-2022-21724same product
- CVE-2022-26520same product
- CVE-2018-10936same product
- CVE-2022-47015same product
- CVE-2026-134842same productpgjdbc simple query mode quotes parameters for the wrong standard_conforming_strings value
- CVE-2026-134841same productpgjdbc parses quoted text as SQL in JDBC escapes, dollar quotes and E strings
Sources for this record
- CVE Program · CVE Program Terms of Use
- FIRST EPSS · EPSS terms of use (free use, attribution requested)
- GitHub Advisory Database · CC-BY-4.0 · GHSA-r38f-c4h4-hqq2
- NVD · Public domain (17 U.S.C. § 105) for NVD-authored data; third-party content under its own terms
- OSV.dev · Per record, as its publisher states it: each row carries the label in sourceLicense when one is served
- Red Hat Product Security (CSAF and VEX) · CC-BY-4.0
- CISA Vulnrichment · CC0-1.0