8.0
HIGH
CVE-2022-31197
PostgreSQL JDBC Driver SQL Injection Vulnerability (Unescaped Column Names)
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.

INFO

Published Date :

Aug. 3, 2022, 7:15 p.m.

Last Modified :

Nov. 7, 2023, 3:47 a.m.

Remotely Exploitable :

Yes !

Impact Score :

5.9

Exploitability Score :

2.1
Public PoC/Exploit Available at Github

CVE-2022-31197 has a 1 public PoC/Exploit available at Github. Go to the Public Exploits tab to see the list.

Affected Products

The following products are affected by CVE-2022-31197 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Fedoraproject fedora
1 Debian debian_linux
1 Postgresql postgresql_jdbc_driver

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

None

Shell

Updated: 1 year, 8 months ago
0 stars 1 fork 1 watcher
Born at : Jan. 6, 2023, 11:03 p.m. This repo has been linked 10 different CVEs too.

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2022-31197 vulnerability anywhere in the article.

The following table lists the changes that have been made to the CVE-2022-31197 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • CVE Modified by [email protected]

    May. 14, 2024

    Action Type Old Value New Value
  • CVE Modified by [email protected]

    Nov. 07, 2023

    Action Type Old Value New Value
    Added Reference GitHub, Inc. https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/ [No types assigned]
    Added Reference GitHub, Inc. https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/ [No types assigned]
    Removed Reference GitHub, Inc. https://lists.fedoraproject.org/archives/list/[email protected]/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/
    Removed Reference GitHub, Inc. https://lists.fedoraproject.org/archives/list/[email protected]/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/
  • Reanalysis by [email protected]

    Feb. 06, 2023

    Action Type Old Value New Value
    Changed CPE Configuration OR *cpe:2.3:a:postgresql:postgresql_jdbc_driver:*:*:*:*:*:*:*:* versions up to (excluding) 42.2.26 *cpe:2.3:a:postgresql:postgresql_jdbc_driver:*:*:*:*:*:*:*:* versions from (including) 42.3.0 up to (excluding) 42.4.1 OR *cpe:2.3:a:postgresql:postgresql_jdbc_driver:*:*:*:*:*:*:*:* versions up to (excluding) 42.2.26 *cpe:2.3:a:postgresql:postgresql_jdbc_driver:*:*:*:*:*:*:*:* versions from (including) 42.3.0 up to (excluding) 42.3.7 *cpe:2.3:a:postgresql:postgresql_jdbc_driver:42.4.0:-:*:*:*:*:*:* *cpe:2.3:a:postgresql:postgresql_jdbc_driver:42.4.0:rc1:*:*:*:*:*:* *cpe:2.3:a:postgresql:postgresql_jdbc_driver:42.4.1:rc1:*:*:*:*:*:*
  • Modified Analysis by [email protected]

    Dec. 02, 2022

    Action Type Old Value New Value
    Changed Reference Type https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html No Types Assigned https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html Mailing List, Third Party Advisory
    Changed Reference Type https://lists.fedoraproject.org/archives/list/[email protected]/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/ No Types Assigned https://lists.fedoraproject.org/archives/list/[email protected]/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/ Mailing List, Third Party Advisory
    Changed Reference Type https://lists.fedoraproject.org/archives/list/[email protected]/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/ No Types Assigned https://lists.fedoraproject.org/archives/list/[email protected]/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/ Mailing List, Third Party Advisory
    Added CPE Configuration OR *cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:* *cpe:2.3:o:fedoraproject:fedora:35:*:*:*:*:*:*:* *cpe:2.3:o:fedoraproject:fedora:36:*:*:*:*:*:*:*
  • CVE Modified by [email protected]

    Oct. 08, 2022

    Action Type Old Value New Value
    Added Reference https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html [No Types Assigned]
  • CVE Modified by [email protected]

    Oct. 06, 2022

    Action Type Old Value New Value
    Added Reference https://lists.fedoraproject.org/archives/list/[email protected]/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/ [No Types Assigned]
    Added Reference https://lists.fedoraproject.org/archives/list/[email protected]/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/ [No Types Assigned]
  • Initial Analysis by [email protected]

    Aug. 09, 2022

    Action Type Old Value New Value
    Added CVSS V3.1 NIST AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
    Changed Reference Type https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637 No Types Assigned https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637 Patch, Third Party Advisory
    Changed Reference Type https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2 No Types Assigned https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2 Exploit, Third Party Advisory
    Added CPE Configuration OR *cpe:2.3:a:postgresql:postgresql_jdbc_driver:*:*:*:*:*:*:*:* versions up to (excluding) 42.2.26 *cpe:2.3:a:postgresql:postgresql_jdbc_driver:*:*:*:*:*:*:*:* versions from (including) 42.3.0 up to (excluding) 42.4.1
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.
CWE - Common Weakness Enumeration

While CVE identifies specific instances of vulnerabilities, CWE categorizes the common flaws or weaknesses that can lead to vulnerabilities. CVE-2022-31197 is associated with the following CWEs:

Exploit Prediction

EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days.

0.12 }} 0.01%

score

0.45623

percentile

CVSS31 - Vulnerability Scoring System
Attack Vector
Attack Complexity
Privileges Required
User Interaction
Scope
Confidentiality
Integrity
Availability