PostgreSQL JDBC Driver up to 42.2.25/42.4.0 java.sql.ResultRow.refreshRow sql injection

CVSS Meta Temp Score
CVSS is a standardized scoring system to determine possibilities of attacks. The Temp Score considers temporal factors like disclosure, exploit and countermeasures. The unique Meta Score calculates the average score of different sources to provide a normalized scoring system.
Current Exploit Price (≈)
Our analysts are monitoring exploit markets and are in contact with vulnerability brokers. The range indicates the observed or calculated exploit price to be seen on exploit markets. A good indicator to understand the monetary effort required for and the popularity of an attack.
CTI Interest Score
Our Cyber Threat Intelligence team is monitoring different web sites, mailing lists, exploit markets and social media networks. The CTI Interest Score identifies the interest of attackers and the security community for this specific vulnerability in real-time. A high score indicates an elevated risk to be targeted for this vulnerability.
6.6$0-$5k0.00

Summaryinfo

A vulnerability was found in PostgreSQL JDBC Driver up to 42.2.25/42.4.0. It has been classified as critical. Affected is the function java.sql.ResultRow.refreshRow. This manipulation causes sql injection. This vulnerability is tracked as CVE-2022-31197. The attack is possible to be carried out remotely. No exploit exists. Upgrading the affected component is recommended.

Detailsinfo

A vulnerability was found in PostgreSQL JDBC Driver up to 42.2.25/42.4.0 (Database Software). It has been declared as critical. Affected by this vulnerability is the function java.sql.ResultRow.refreshRow. The manipulation with an unknown input leads to a sql injection vulnerability. The CWE definition for the vulnerability is CWE-89. The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. As an impact it is known to affect confidentiality, integrity, and availability. The summary by CVE is:

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.

The weakness was disclosed 08/04/2022 as GHSA-r38f-c4h4-hqq2. It is possible to read the advisory at github.com. This vulnerability is known as CVE-2022-31197 since 05/18/2022. Technical details of the vulnerability are known, but there is no available exploit. The attack technique deployed by this issue is T1505 according to MITRE ATT&CK.

The vulnerability scanner Nessus provides a plugin with the ID 213039 (Debian dla-3995 : libpostgresql-jdbc-java - security update), which helps to determine the existence of the flaw in a target environment.

Upgrading to version 42.2.26 or 42.4.1 eliminates this vulnerability. Applying the patch 739e599d52ad80f8dcd6efedc6157859b1a9d637 is able to eliminate this problem. The bugfix is ready for download at github.com. The best possible mitigation is suggested to be upgrading to the latest version.

The vulnerability is also documented in the vulnerability database at Tenable (213039). Be aware that VulDB is the high quality source for vulnerability data.

Productinfo

Type

Name

Version

License

CPE 2.3info

CPE 2.2info

CVSSv4info

VulDB Vector: 🔍
VulDB Reliability: 🔍

CVSSv3info

VulDB Meta Base Score: 6.7
VulDB Meta Temp Score: 6.6

VulDB Base Score: 5.0
VulDB Temp Score: 4.8
VulDB Vector: 🔍
VulDB Reliability: 🔍

NVD Base Score: 8.0
NVD Vector: 🔍

CNA Base Score: 7.1
CNA Vector (GitHub, Inc.): 🔍

CVSSv2info

AVACAuCIA
💳💳💳💳💳💳
💳💳💳💳💳💳
💳💳💳💳💳💳
VectorComplexityAuthenticationConfidentialityIntegrityAvailability
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock

VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍

Exploitinginfo

Class: Sql injection
CWE: CWE-89 / CWE-74 / CWE-707
CAPEC: 🔍
ATT&CK: 🔍

Physical: No
Local: No
Remote: Yes

Availability: 🔍
Status: Not defined

EPSS Score: 🔍
EPSS Percentile: 🔍

Price Prediction: 🔍
Current Price Estimation: 🔍

0-DayUnlockUnlockUnlockUnlock
TodayUnlockUnlockUnlockUnlock

Nessus ID: 213039
Nessus Name: Debian dla-3995 : libpostgresql-jdbc-java - security update

Threat Intelligenceinfo

Interest: 🔍
Active Actors: 🔍
Active APT Groups: 🔍

Countermeasuresinfo

Recommended: Upgrade
Status: 🔍

0-Day Time: 🔍

Upgrade: PostgreSQL JDBC Driver 42.2.26/42.4.1
Patch: 739e599d52ad80f8dcd6efedc6157859b1a9d637

Timelineinfo

05/18/2022 🔍
08/04/2022 +78 days 🔍
08/04/2022 +0 days 🔍
11/04/2025 +1188 days 🔍

Sourcesinfo

Advisory: GHSA-r38f-c4h4-hqq2
Status: Confirmed

CVE: CVE-2022-31197 (🔍)
GCVE (CVE): GCVE-0-2022-31197
GCVE (VulDB): GCVE-100-205567

Entryinfo

Created: 08/04/2022 07:55
Updated: 11/04/2025 16:31
Changes: 08/04/2022 07:55 (43), 08/30/2022 09:49 (21), 12/16/2024 17:04 (16), 11/04/2025 16:31 (1)
Complete: 🔍
Cache ID: 216::103

Be aware that VulDB is the high quality source for vulnerability data.

Discussion

No comments yet. Languages: en.

Please log in to comment.

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!