Lookup for vulnerable packages by Package URL.

Purlpkg:apk/alpine/java-postgresql-jdbc@42.4.2-r0?arch=x86_64&distroversion=v3.21&reponame=community
Typeapk
Namespacealpine
Namejava-postgresql-jdbc
Version42.4.2-r0
Qualifiers
arch x86_64
distroversion v3.21
reponame community
Subpath
Is_vulnerablefalse
Next_non_vulnerable_version42.5.1-r0
Latest_non_vulnerable_version42.6.2-r0
Affected_by_vulnerabilities
Fixing_vulnerabilities
0
url VCID-ba8g-gn36-7bdp
vulnerability_id VCID-ba8g-gn36-7bdp
summary
PostgreSQL JDBC Driver SQL Injection in ResultSet.refreshRow() with malicious column names
### Impact
_What kind of vulnerability is it? Who is impacted?_

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.

For example:

```sql
CREATE TABLE refresh_row_example (
  id     int PRIMARY KEY,
  "1 FROM refresh_row_example; SELECT pg_sleep(10); SELECT * " int
);
```

This example has a table with two columns. The name of the second column is crafted to contain a statement terminator followed by additional SQL. Invoking the `ResultSet.refreshRow()` on a ResultSet that queried this table, e.g. `SELECT * FROM refresh_row`, would cause the additional SQL commands such as the `SELECT pg_sleep(10)` invocation to be executed.

As the multi statement command would contain multiple results, it would not be possible for the attacker to get data directly out of this approach as the `ResultSet.refreshRow()` method would throw an exception. However, the attacker could execute any arbitrary SQL including inserting the data into another table that could then be read or any other DML / DDL statement.

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.

### Patches
_Has the problem been patched? What versions should users upgrade to?_

Yes, versions 42.2.26, 42.3.7, and 42.4.1 have been released with a fix.

### Workarounds
_Is there a way for users to fix or remediate the vulnerability without upgrading?_

Check that you are not using the `ResultSet.refreshRow()` method.

If you are, ensure that the code that executes that method does not connect to a database that is controlled by an unauthenticated or malicious user. If your application only connects to its own database with a fixed schema with no DDL permissions, then you will not be affected by this vulnerability as it requires a maliciously crafted schema.
references
0
reference_url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2022-31197.json
reference_id
reference_type
scores
0
value 8.0
scoring_system cvssv3
scoring_elements CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H
url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2022-31197.json
1
reference_url https://api.first.org/data/v1/epss?cve=CVE-2022-31197
reference_id
reference_type
scores
0
value 0.02768
scoring_system epss
scoring_elements 0.86076
published_at 2026-04-29T12:55:00Z
1
value 0.03579
scoring_system epss
scoring_elements 0.8777
published_at 2026-04-24T12:55:00Z
2
value 0.03579
scoring_system epss
scoring_elements 0.87753
published_at 2026-04-21T12:55:00Z
3
value 0.03579
scoring_system epss
scoring_elements 0.87754
published_at 2026-04-18T12:55:00Z
4
value 0.03579
scoring_system epss
scoring_elements 0.87741
published_at 2026-04-13T12:55:00Z
5
value 0.03579
scoring_system epss
scoring_elements 0.87776
published_at 2026-04-26T12:55:00Z
6
value 0.03579
scoring_system epss
scoring_elements 0.87732
published_at 2026-04-08T12:55:00Z
7
value 0.03579
scoring_system epss
scoring_elements 0.87711
published_at 2026-04-07T12:55:00Z
8
value 0.03579
scoring_system epss
scoring_elements 0.87709
published_at 2026-04-04T12:55:00Z
9
value 0.03579
scoring_system epss
scoring_elements 0.87697
published_at 2026-04-02T12:55:00Z
10
value 0.03579
scoring_system epss
scoring_elements 0.87755
published_at 2026-04-16T12:55:00Z
11
value 0.03579
scoring_system epss
scoring_elements 0.87743
published_at 2026-04-12T12:55:00Z
12
value 0.03579
scoring_system epss
scoring_elements 0.87749
published_at 2026-04-11T12:55:00Z
13
value 0.03579
scoring_system epss
scoring_elements 0.87738
published_at 2026-04-09T12:55:00Z
url https://api.first.org/data/v1/epss?cve=CVE-2022-31197
2
reference_url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-31197
reference_id
reference_type
scores
url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-31197
3
reference_url https://ftp.suse.com/pub/projects/security/yaml/suse-cvss-scores.yaml
reference_id
reference_type
scores
0
value 8.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N
url https://ftp.suse.com/pub/projects/security/yaml/suse-cvss-scores.yaml
4
reference_url https://github.com/pgjdbc/pgjdbc
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://github.com/pgjdbc/pgjdbc
5
reference_url https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
2
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:N/T:T/P:M/B:A/M:M/D:R/2025-04-22T15:42:38Z/
url https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637
6
reference_url https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system cvssv3.1_qr
scoring_elements
2
value HIGH
scoring_system generic_textual
scoring_elements
3
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:N/T:T/P:M/B:A/M:M/D:R/2025-04-22T15:42:38Z/
url https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2
7
reference_url https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
2
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:N/T:T/P:M/B:A/M:M/D:R/2025-04-22T15:42:38Z/
url https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html
8
reference_url https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html
9
reference_url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP
10
reference_url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S
11
reference_url https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP
12
reference_url https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S
13
reference_url https://nvd.nist.gov/vuln/detail/CVE-2022-31197
reference_id
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value HIGH
scoring_system generic_textual
scoring_elements
url https://nvd.nist.gov/vuln/detail/CVE-2022-31197
14
reference_url https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016662
reference_id 1016662
reference_type
scores
url https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1016662
15
reference_url https://bugzilla.redhat.com/show_bug.cgi?id=2129428
reference_id 2129428
reference_type
scores
url https://bugzilla.redhat.com/show_bug.cgi?id=2129428
16
reference_url https://github.com/advisories/GHSA-r38f-c4h4-hqq2
reference_id GHSA-r38f-c4h4-hqq2
reference_type
scores
0
value HIGH
scoring_system cvssv3.1_qr
scoring_elements
url https://github.com/advisories/GHSA-r38f-c4h4-hqq2
17
reference_url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/
reference_id I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:N/T:T/P:M/B:A/M:M/D:R/2025-04-22T15:42:38Z/
url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/
18
reference_url https://access.redhat.com/errata/RHSA-2022:8652
reference_id RHSA-2022:8652
reference_type
scores
url https://access.redhat.com/errata/RHSA-2022:8652
19
reference_url https://access.redhat.com/errata/RHSA-2022:9023
reference_id RHSA-2022:9023
reference_type
scores
url https://access.redhat.com/errata/RHSA-2022:9023
20
reference_url https://access.redhat.com/errata/RHSA-2023:0318
reference_id RHSA-2023:0318
reference_type
scores
url https://access.redhat.com/errata/RHSA-2023:0318
21
reference_url https://access.redhat.com/errata/RHSA-2023:1006
reference_id RHSA-2023:1006
reference_type
scores
url https://access.redhat.com/errata/RHSA-2023:1006
22
reference_url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/
reference_id UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S
reference_type
scores
0
value 7.1
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H
1
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:N/T:T/P:M/B:A/M:M/D:R/2025-04-22T15:42:38Z/
url https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/
fixed_packages
0
url pkg:apk/alpine/java-postgresql-jdbc@42.4.2-r0?arch=x86_64&distroversion=v3.21&reponame=community
purl pkg:apk/alpine/java-postgresql-jdbc@42.4.2-r0?arch=x86_64&distroversion=v3.21&reponame=community
is_vulnerable false
affected_by_vulnerabilities
resource_url http://public2.vulnerablecode.io/packages/pkg:apk/alpine/java-postgresql-jdbc@42.4.2-r0%3Farch=x86_64&distroversion=v3.21&reponame=community
aliases CVE-2022-31197, GHSA-r38f-c4h4-hqq2
risk_score 4.0
exploitability 0.5
weighted_severity 8.0
resource_url http://public2.vulnerablecode.io/vulnerabilities/VCID-ba8g-gn36-7bdp
Risk_scorenull
Resource_urlhttp://public2.vulnerablecode.io/packages/pkg:apk/alpine/java-postgresql-jdbc@42.4.2-r0%3Farch=x86_64&distroversion=v3.21&reponame=community