Skip to main content
Mallory
HighPublic exploitVulnerability

CVE-2022-31197: SQL Injection in PgJDBC ResultSet.refreshRow()

Published Aug 3, 2022 · Updated 1 month ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 daysNo mention activity in the last 30 days.
CVSS8.0High · v3.1
EPSS2.4%84th percentile
CISA KEVNoNot listed
In the wildReported1 exploitation record in Mallory
Vendors
Debian ProjectFedora ProjectPostgresql
IdentifiersCVE-2022-31197CWE-89 · Improper Neutralization of Special…

CVE-2022-31197 is an SQL injection vulnerability in the PostgreSQL JDBC Driver (PgJDBC) implementation of java.sql.ResultSet.refreshRow(). The driver constructs SQL using result-set column names without correctly escaping those identifiers. A malicious column name containing a statement terminator can therefore inject additional SQL statements when an application invokes refreshRow() on the affected ResultSet. Injected statements execute with the privileges of the JDBC connection user.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation permits execution of attacker-supplied SQL commands as the application's JDBC user. Depending on that user's database privileges, this can enable unauthorized reading, modification, or deletion of data; DDL changes; and abuse of privileges in schemas accessible to that user. The risk is particularly significant where a privileged application account queries schemas that can be created or modified by less-privileged or malicious database users.

Mitigation

If you can’t patch tonight, do this now.

No complete workaround is available other than updating. Until patched, avoid invoking ResultSet.refreshRow(). Where its use cannot be removed, prevent application JDBC accounts from querying attacker-controlled databases or schemas, restrict untrusted users from creating or altering tables and column names in schemas visible to the application, and apply least privilege to JDBC accounts.

Remediation

Patch, then assume compromise.

Upgrade PgJDBC to a fixed release in the applicable maintenance branch: 42.2.26, 42.3.7, 42.4.1, or later. Update transitive PgJDBC dependencies in affected application platforms and rebuild or redeploy applications as necessary.

Public exploits

Exploits

No public exploits tracked yet. Mallory keeps watching.

View more in app →
No public exploit code observed for this vulnerability. Mallory keeps watching.
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
Debian ProjectDebian Linuxoperating_system
Fedora ProjectFedoraoperating_system
PostgresqlPostgresql Jdbc Driverapplication
FAQ

Frequently asked questions

Is CVE-2022-31197 exploited in the wild?
Yes. As of Oct 16, 2026, Mallory has reports of exploitation in the wild.
Is there a public exploit for CVE-2022-31197?
Yes. As of Oct 16, 2026, Mallory has reports of a public exploit for CVE-2022-31197.
Is there a patch for CVE-2022-31197?
Upgrade PgJDBC to a fixed release in the applicable maintenance branch: 42.2.26, 42.3.7, 42.4.1, or later. Update transitive PgJDBC dependencies in affected application platforms and rebuild or redeploy applications as necessary.
What products are affected by CVE-2022-31197?
Postgresql Jdbc Driver, Debian Project Debian Linux, and Fedora Project Fedora.
How severe is CVE-2022-31197?
CVE-2022-31197 has a CVSS v3.1 score of 8.0 (High) and an EPSS score of 2.4% (84th percentile) as of Oct 16, 2026.
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidence1Every report linking this CVE to a named adversary.
Associated malware1Malware families linked to this CVE, with evidence and IOCs.
Detection signaturesYARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity2Community discussion across Reddit, Mastodon, and other social sources.