# PostgreSQL JDBC Driver SQL Injection in ResultSet.refreshRow() with malicious column names

Advisory record · `GHSA-r38f-c4h4-hqq2`

- **Identifiers:** `GHSA-r38f-c4h4-hqq2` · `BIT-postgresql-jdbc-driver-2022-31197` · `CVE-2022-31197`
- **State:** Confirmed
- **Severity:** CVSS 7.1 High
- **Critical:** No
- **Weakness (CWE):** [CWE-89](https://cwe.mitre.org/data/definitions/89.html)
- **Tags:** [SQL injection](https://agentprime.io/advisories/tag/sql-injection.md)
- **Published:** 6 Aug 2022
- **Updated:** 10 Sept 2026
- **Reviewed by a person:** No

Published by the GitHub Advisory Database at 6 Aug 2022, 05:51 UTC. agentprime has not analysed this yet, so whether it affects any app is not known.

## Affected packages

- `org.postgresql:postgresql` (Maven): affected `<42.2.26 || >=42.4.0, <42.4.1 || >=42.3.0, <42.3.7`; fixed in `42.2.26`, `42.4.1`, `42.3.7`

## Machine-written summary

Summary written by Claude Haiku from the source advisory. Not reviewed by a person.

> The PostgreSQL JDBC driver (org.postgresql:postgresql) versions before 42.2.26, 42.3.0 through 42.3.6, and 42.4.0 are affected. The refreshRow() method does not escape column names, so a column name containing a statement terminator can lead to SQL injection when the application queries a database an attacker controls. Upgrade to 42.2.26, 42.3.7, 42.4.1 or later. Alternatively, avoid calling refreshRow().

Written 2 Nov 2026.

## Not analysed yet

We haven’t published our analysis of this Advisory yet. Once a person has reviewed it, this page will say what’s vulnerable, what has to be true for your app to be affected, and how to check.

## Severity and exploitation

- 7.1 High, CVSS 3.1: `CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H`, from CNA (GitHub_M)

- **CISA KEV:** Not listed.
- **EPSS:** 0.024, the 84th percentile, on 16 Nov 2026: FIRST’s estimate of the chance of exploitation in the next 30 days.

## Timeline

- 31 Oct 2026, 14:18 UTC: First seen by agentprime
- 31 Oct 2026, 14:18 UTC: [Confirmed by OSV](https://osv.dev/vulnerability/GHSA-r38f-c4h4-hqq2)

## Sources

- [GitHub Advisory Database: GHSA-r38f-c4h4-hqq2](https://github.com/advisories/GHSA-r38f-c4h4-hqq2)
- [OSV: GHSA-r38f-c4h4-hqq2](https://osv.dev/vulnerability/GHSA-r38f-c4h4-hqq2)
- <https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2>
- <https://nvd.nist.gov/vuln/detail/CVE-2022-31197>
- <https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637>
- <https://github.com/pgjdbc/pgjdbc>
- <https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html>
- <https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html>
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP>
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S>
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP>
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S>

Facts on this page come from the GitHub Advisory Database (CC-BY 4.0), OSV and the other sources listed, as published. We don’t reproduce full advisory descriptions, which can contain exploit code.

## Check whether this affects you

A Match means an installed version is in the affected range above. Most don’t affect the app; agentprime hasn’t analysed this one yet.

- With the agentprime MCP server (<https://api.agentprime.io/mcp>), ask your agent to check the project: `check_lockfile` sends a lockfile, `check_packages` a list of installed packages, and both return the Matches and the upgrades that clear them. `get_advisory` returns this record. Setup: <https://agentprime.io/mcp.md>
- In a browser: <https://agentprime.io/check/> reads your lockfile in the browser, never uploading it.
- Whether it touches your code, with file and line: the Claude Code plugin, <https://agentprime.io/plugin.md>
- As JSON: <https://api.agentprime.io/v1/advisories/GHSA-r38f-c4h4-hqq2>, or `POST https://api.agentprime.io/v1/match` with your packages (<https://agentprime.io/api.md>)

---

The web page: <https://agentprime.io/advisories/GHSA-r38f-c4h4-hqq2/>. Everything for agents: <https://agentprime.io/llms.txt>.
