UBUNTU-CVE-2022-31197 (CVE-2022-31197)

Vulnerability from osv_ubuntu – Published: 2022-08-03 19:15 – Updated: 2026-11-24 09:48 – Source website
VLAI
Details

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.

Upstream
Impacted products
Ecosystem Package Version
Ubuntu:14.04:LTS libpgjava
pkg:deb/ubuntu/libpgjava@9.2-1002-1?arch=source&distro=trusty
Affected: All versions (ecosystem)
9.2-1002-1
Ubuntu:16.04:LTS libpgjava
pkg:deb/ubuntu/libpgjava@9.2-1002-1?arch=source&distro=xenial
Affected: All versions (ecosystem)
9.2-1002-1
Ubuntu:Pro:18.04:LTS libpgjava
pkg:deb/ubuntu/libpgjava@9.4.1212-1ubuntu0.1~esm1?arch=source&distro=esm-apps/bionic
Affected: All versions (ecosystem)
9.4.1212-19.4.1212-1ubuntu0.1~esm1
Ubuntu:Pro:20.04:LTS libpgjava
pkg:deb/ubuntu/libpgjava@42.2.10-1ubuntu0.1~esm1?arch=source&distro=esm-apps/focal
Affected: All versions (ecosystem)
42.2.6-142.2.8-142.2.9-142.2.10-142.2.10-1ubuntu0.1~esm1
Ubuntu:22.04:LTS libpgjava
pkg:deb/ubuntu/libpgjava@42.3.3-1?arch=source&distro=jammy
Affected: All versions (ecosystem)
42.2.23-142.2.24-142.3.1-142.3.2-142.3.3-1
Ubuntu:24.04:LTS libpgjava
pkg:deb/ubuntu/libpgjava@42.7.2-1?arch=source&distro=noble
Affected: All versions (ecosystem)
42.5.4-142.6.0-242.7.0-142.7.1-142.7.2-1
Ubuntu:25.10 libpgjava
pkg:deb/ubuntu/libpgjava@42.7.7-1?arch=source&distro=questing
Affected: All versions (ecosystem)
42.7.5-142.7.5-242.7.7-1
Ubuntu:26.10 libpgjava
pkg:deb/ubuntu/libpgjava@42.7.13-1?arch=source&distro=stonking
Affected: All versions (ecosystem)
42.7.10-142.7.11-142.7.12-142.7.13-1
Ubuntu:26.04:LTS libpgjava
pkg:deb/ubuntu/libpgjava@42.7.10-1?arch=source&distro=resolute
Affected: All versions (ecosystem)
42.7.7-142.7.8-142.7.8-242.7.9-142.7.10-1

{
  "affected": [
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpg-java",
            "binary_version": "9.2-1002-1"
          },
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "9.2-1002-1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:14.04:LTS",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@9.2-1002-1?arch=source\u0026distro=trusty"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "9.2-1002-1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpg-java",
            "binary_version": "9.2-1002-1"
          },
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "9.2-1002-1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:16.04:LTS",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@9.2-1002-1?arch=source\u0026distro=xenial"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "9.2-1002-1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "9.4.1212-1ubuntu0.1~esm1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:Pro:18.04:LTS",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@9.4.1212-1ubuntu0.1~esm1?arch=source\u0026distro=esm-apps/bionic"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "9.4.1212-1",
        "9.4.1212-1ubuntu0.1~esm1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "42.2.10-1ubuntu0.1~esm1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:Pro:20.04:LTS",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@42.2.10-1ubuntu0.1~esm1?arch=source\u0026distro=esm-apps/focal"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "42.2.6-1",
        "42.2.8-1",
        "42.2.9-1",
        "42.2.10-1",
        "42.2.10-1ubuntu0.1~esm1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "42.3.3-1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:22.04:LTS",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@42.3.3-1?arch=source\u0026distro=jammy"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "42.2.23-1",
        "42.2.24-1",
        "42.3.1-1",
        "42.3.2-1",
        "42.3.3-1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "42.7.2-1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:24.04:LTS",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@42.7.2-1?arch=source\u0026distro=noble"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "42.5.4-1",
        "42.6.0-2",
        "42.7.0-1",
        "42.7.1-1",
        "42.7.2-1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "42.7.7-1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:25.10",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@42.7.7-1?arch=source\u0026distro=questing"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "42.7.5-1",
        "42.7.5-2",
        "42.7.7-1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "42.7.13-1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:26.10",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@42.7.13-1?arch=source\u0026distro=stonking"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "42.7.10-1",
        "42.7.11-1",
        "42.7.12-1",
        "42.7.13-1"
      ]
    },
    {
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "libpostgresql-jdbc-java",
            "binary_version": "42.7.10-1"
          }
        ]
      },
      "package": {
        "ecosystem": "Ubuntu:26.04:LTS",
        "name": "libpgjava",
        "purl": "pkg:deb/ubuntu/libpgjava@42.7.10-1?arch=source\u0026distro=resolute"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ],
      "versions": [
        "42.7.7-1",
        "42.7.8-1",
        "42.7.8-2",
        "42.7.9-1",
        "42.7.10-1"
      ]
    }
  ],
  "aliases": [],
  "details": "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\u0027s 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\u0027s column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application\u0027s 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.",
  "id": "UBUNTU-CVE-2022-31197",
  "modified": "2026-11-24T09:48:08Z",
  "published": "2022-08-03T19:15:00Z",
  "references": [
    {
      "type": "REPORT",
      "url": "https://ubuntu.com/security/CVE-2022-31197"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637"
    },
    {
      "type": "REPORT",
      "url": "https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637"
    },
    {
      "type": "REPORT",
      "url": "https://www.cve.org/CVERecord?id=CVE-2022-31197"
    }
  ],
  "related": [],
  "schema_version": "1.9.2",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H",
      "source": "CNA",
      "type": "CVSS_V3"
    },
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H",
      "source": "NVD",
      "type": "CVSS_V3"
    },
    {
      "score": "medium",
      "source": "SELF",
      "type": "Ubuntu"
    }
  ],
  "upstream": [
    "CVE-2022-31197"
  ]
}



Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.

Forecast uses a logistic model when the trend is rising, or an exponential decay model when the trend is falling. Fitted via linearized least squares.

Sightings

Author Source Type Date Other

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline

Sightings and recorded dates, grouped by day · UTC

JSON
How durations are calculated

Following the VTEM framework (Black Hat USA 2015), time to patch starts when the vendor or a coordinator was informed, total time to patch at discovery, and disclosure to patch at public disclosure; vendor response time runs from the report to its acknowledgement. Time to exploit and time unpatched start at the earliest discovery or report, falling back to public disclosure. Unpatched time ends at the first recorded patch, or the calculation time when no patch is recorded. Exploitation to patch shows the interval between those two events; a published proof of concept is a public exploit, not exploitation. The method is described in a publication.

Each result shows its source dates. A negative interval means the end event came first; when date-only inputs leave the order open, the result says so. Date-only inputs are approximate. The earliest evidence wins: KEV report dates and sightings are labelled as such. Records describing another vulnerability are listed but never calculated from, and a PoC alone does not establish exploitation. Missing patch evidence does not prove that no patch exists. Filters below change the event list only.

Events included in the timeline

Loading timeline…


    Loading…

    Loading…

    Loading…

    Related by attack behaviour

    Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.