Skip to content
Noroxi
NVD / CVE Program· CNA GitHub_M

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

Noroxi assessment

Priority: Monitor (action score 33/100)

  • The sources we track (CISA KEV, Exploit-DB, Metasploit, Nuclei, GitHub) show no public exploit code or exploitation in the wild.
  • Probability of exploitation in the next 30 days: 2.3% (FIRST EPSS); higher than 83.8% of all records.
  • Anyone who can reach it over the internet can trigger it. A low-privileged account is enough. A user must open a link or visit a page. No special conditions are required; it is repeatable.
  • Fixed version: postgresql-jdbc (AlmaLinux:9) 42.2.18-6.el9_1; java-postgresql-jdbc (Alpine:v3.16) 42.4.2-r0; libpgjava (Debian:10) 42.2.5-2+deb10u2.

Low priority for now. Upgrade to postgresql-jdbc (AlmaLinux:9) 42.2.18-6.el9_1; java-postgresql-jdbc (Alpine:v3.16) 42.4.2-r0; libpgjava (Debian:10) 42.2.5-2+deb10u2 or later.

Generated automatically from the record's data: CVSS (NVD and CNA), CISA KEV and SSVC, FIRST EPSS, exploit sources, fixed versions. How we calculate it

Primary sources: NVD · CVE.org · FIRST EPSS

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.

HighCVSS 8.0 · v3.1—No exploit Fix available
Published
Aug 3, 2022
Updated
Jun 17, 2026
EPSS
2.3% · 83th percentile

Report tools

JSON

Action score

33

Monitor

Low priority for now.

CVSS
32 / 40 · 8.0 / 10
CISA KEV
0 / 30 · Not listed
EPSS
1 / 30 · 2.3%

CISA SSVC decision

Exploitation
proof of concept
Automatable
no
Technical impact
total

Vulnrichment: CISA's decision-tree inputs.

CNA vs NVD score

NVD
8.0
CNA · GitHub_M
7.1
0.9 point gap

CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H

The score given by the assigning authority versus NVD’s independent score. A gap means the severity is contested.

Get told when this record changes

  • Not in KEV: no record of exploitation in the wild
  • No public exploit code on record
  • A fix has been released

If any of these changes, we'll tell you in the daily email digest.

Follow CVE-2022-31197

When you'll hear from us

  • when it enters CISA KEV
  • when exploit code appears or is weaponized
  • when the record is updated (including a fixed version)
  • when EPSS rises 20 points in a week

One daily email digest (06:00 UTC); connect a webhook for KEV listings and weaponized exploits instantly.

Your free account also gets you

Running WordPress? Scan your site free with WP Lens

  • Stack alerts: add the products and versions you run, get the new CVEs that affect them
  • Uptime monitoring: 1 site, instant email when it goes down
  • Add your domain: subdomains and takeover risk scanned every week (1 domain)
  • 10 scans an hour on the security tools (3 a day without an account), an API key and MCP
  • All your scans in one panel: findings, what changed in the last scan, a report per domain or per client (PDF, share link)
All free tools

Sign up with email · Have an account? Sign in

Free account, no card. Unfollow any time.

Running WordPress? Scan your site free with WP Lens

Is your version affected? Check it

Noroxi analysis

What does it mean in your environment?

The assessment above is generated automatically from the record's data; it doesn't know your environment. Our team verifies on your systems whether this vulnerability is actually exploitable and which mitigation is enough.

We use this product, ask for help

Affected systems

Is your version affected?

Pick the product and type the version you run. It's compared with this record's version ranges in your browser; the version isn't sent anywhere.

VendorProduct
postgresqlpostgresql jdbc driver
debiandebian linux
fedoraprojectfedora

Affected versions

NVD version ranges (for catalog products). Add the product to your stack with a version and matching uses these.

  • debian debian linux10.0
  • fedoraproject fedora35
  • fedoraproject fedora36
  • postgresql postgresql jdbc driver42.3.0 and later · before 42.3.7
  • postgresql postgresql jdbc driverbefore 42.2.26
  • postgresql postgresql jdbc driver42.4.0
  • postgresql postgresql jdbc driver42.4.1

Versions reported by the vendor

Affected version ranges reported by the assigning authority (GitHub_M). Independent of NVD's CPE analysis and usually ahead of it.

  • pgjdbc pgjdbc

    • >= 42.2.0, < 42.2.26, >= 42.3.0, < 42.4.1affected

Package-level exposure

OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.

EcosystemPackageAffected rangeFix
AlmaLinux:9postgresql-jdbcbefore 42.2.18-6.el9_142.2.18-6.el9_1
Alpine:v3.16java-postgresql-jdbcbefore 42.4.2-r042.4.2-r0
Debian:10libpgjavabefore 42.2.5-2+deb10u242.2.5-2+deb10u2
Debian:11libpgjavabefore 42.2.15-1+deb11u242.2.15-1+deb11u2
Debian:12libpgjavabefore 42.4.1-142.4.1-1
Mavenorg.postgresql:postgresqlfrom 42.3.0 · before 42.3.742.3.7
Mavenorg.postgresql:postgresqlfrom 42.4.0 · before 42.4.142.4.1
Mavenorg.postgresql:postgresqlbefore 42.2.2642.2.26
openSUSE:Leap 15.3postgresql-jdbcbefore 42.2.25-150300.3.8.142.2.25-150300.3.8.1
openSUSE:Leap 15.4postgresql-jdbcbefore 42.2.25-150400.3.6.142.2.25-150400.3.6.1
Red Hat:enterprise_linux:9::appstreampostgresql-jdbcbefore 0:42.2.18-6.el9_10:42.2.18-6.el9_1
Rocky Linux:9postgresql-jdbcbefore 0:42.2.18-6.el9_10:42.2.18-6.el9_1
SUSE:Linux Enterprise Module for Server Applications 15 SP4postgresql-jdbcbefore 42.2.25-150400.3.6.142.2.25-150400.3.6.1
SUSE:Manager Server Module 4.1postgresql-jdbcbefore 42.2.10-150200.3.11.142.2.10-150200.3.11.1
SUSE:Manager Server Module 4.2postgresql-jdbcbefore 42.2.25-150300.3.8.142.2.25-150300.3.8.1
SUSE:OpenStack Cloud 9postgresql-jdbcbefore 9.4-3.6.39.4-3.6.3

Other highest-scoring records for the same primary product.

  • CVE-2024-1597pgjdbc SQL Injection via line comment generation
    40Plan
  • CVE-2022-26520In pgjdbc before 42.3.3, an attacker (who controls the jdbc URL or properties) can call java.util.logging.FileHandler to write to arbitrary
    40Plan
  • CVE-2022-21724Unchecked Class Instantiation when providing Plugin Classes
    40Plan

Published before and after this one in the same product

  • ← EarlierCVE-2018-10936Aug 30, 2018 · A weakness was found in postgresql-jdbc before version 42.2.5.
    33Monitor
  • ← EarlierCVE-2020-13692Jun 4, 2020 · PostgreSQL JDBC Driver (aka PgJDBC) before 42.2.13 allows XXE.
    31Monitor
  • Later →CVE-2022-41946Nov 23, 2022 · TemporaryFolder on unix-like systems does not limit access to created files in pgjdbc
    22Monitor

Remediation

Which version to upgrade to

Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.

Product / packageFixed versionSource
almalinux:postgresql-jdbc42.2.18-6.el9_1 · AlmaLinux:9Package registry (OSV)
alpine:java-postgresql-jdbc42.4.2-r0 · Alpine:v3.16Package registry (OSV)
debian:libpgjava42.4.1-1 · Debian:12Package registry (OSV)
Maven:org.postgresql:postgresql42.2.26Package registry (OSV)
Maven:org.postgresql:postgresql42.3.7Package registry (OSV)
Maven:org.postgresql:postgresql42.4.1Package registry (OSV)
opensuse:postgresql-jdbc42.2.25-150400.3.6.1 · openSUSE:Leap 15.4Package registry (OSV)
red hat:postgresql-jdbc0:42.2.18-6.el9_1 · Red Hat:enterprise_linux:9::appstreamPackage registry (OSV)
rocky linux:postgresql-jdbc0:42.2.18-6.el9_1 · Rocky Linux:9Package registry (OSV)
suse:postgresql-jdbc42.2.25-150400.3.6.1 · SUSE:Linux Enterprise Module for Server Applications 15 SP4Package registry (OSV)

Exploit status

No known public exploit

No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.

Research context

For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.

Timeline

From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.

No dated events beyond publication.

No history yet (it accumulates with the daily EPSS job).

Patch and commit links

Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.

Finders, reporters and analysts named in the CNA record. Click a name for that researcher’s other records.

No credits in the CNA record.

Variant candidates

Same product, same weakness class, within 18 months. If the patch missed the root cause, the sibling bug is here.

No nightly-computed relations.

Chain candidates

An authentication bypass and a privilege-requiring bug in the same product, published close together: combined they may become an unauthenticated path.

—

Bug bounty scope

No known public program.

Source: bounty-targets-data (public HackerOne, Bugcrowd, Intigriti, YesWeHack listings).

Technical details

Attack conditions

  • Anyone who can reach it over the internet can trigger it.
  • A low-privileged account is enough.
  • A user must open a link or visit a page.
  • No special conditions are required; it is repeatable.

If successful

Confidentiality
high · data can be read
Integrity
high · data or configuration can be modified
Availability
high · the service can be disrupted
Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality impact
High
Integrity impact
High
Availability impact
High

CVSS vector

CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H

nvd-primary

Root cause

The query text is built by concatenating user input. The database cannot tell where the data ends and the command begins.

A representative example of this vulnerability class. Not the vendor's source code; it shows the faulty pattern and its fix.

Vulnerable

ts
const owner = req.query.owner;const rows = await db.query(  "SELECT * FROM files WHERE owner = '" + owner + "'");

Fixed

ts
const owner = req.query.owner;const rows = await db.query(  "SELECT * FROM files WHERE owner = $1",  [owner]);

Change log

  1. Fix✗ → ✓

For records you follow, these changes also arrive as notifications. →

References

All records