Lookup for vulnerable packages by Package URL.

Purlpkg:apk/alpine/java-postgresql-jdbc@42.6.2-r0?arch=x86_64&distroversion=edge&reponame=community
Typeapk
Namespacealpine
Namejava-postgresql-jdbc
Version42.6.2-r0
Qualifiers
arch x86_64
distroversion edge
reponame community
Subpath
Is_vulnerablefalse
Next_non_vulnerable_version42.7.9-r0
Latest_non_vulnerable_version42.7.9-r0
Affected_by_vulnerabilities
Fixing_vulnerabilities
0
url VCID-6r4u-tem9-vkey
vulnerability_id VCID-6r4u-tem9-vkey
summary
org.postgresql:postgresql vulnerable to SQL Injection via line comment generation
# Impact
SQL injection is possible when using the non-default connection property `preferQueryMode=simple` in combination with application code that has a vulnerable SQL that negates a parameter value.

There is no vulnerability in the driver when using the default query mode. Users that do not override the query mode are not impacted.

# Exploitation

To exploit this behavior the following conditions must be met:

1. A placeholder for a numeric value must be immediately preceded by a minus (i.e. `-`)
1. There must be a second placeholder for a string value after the first placeholder on the same line. 
1. Both parameters must be user controlled.

The prior behavior of the driver when operating in simple query mode would inline the negative value of the first parameter and cause the resulting line to be treated as a `--` SQL comment. That would extend to the beginning of the next parameter and cause the quoting of that parameter to be consumed by the comment line. If that string parameter includes a newline, the resulting text would appear unescaped in the resulting SQL.

When operating in the default extended query mode this would not be an issue as the parameter values are sent separately to the server. Only in simple query mode the parameter values are inlined into the executed SQL causing this issue.

# Example

```java
PreparedStatement stmt = conn.prepareStatement("SELECT -?, ?");
stmt.setInt(1, -1);
stmt.setString(2, "\nWHERE false --");
ResultSet rs = stmt.executeQuery();
```

The resulting SQL when operating in simple query mode would be:

```sql
SELECT --1,'
WHERE false --'
```

The contents of the second parameter get injected into the command. Note how both the number of result columns and the WHERE clause of the command have changed. A more elaborate example could execute arbitrary other SQL commands.

# Patch
Problem will be patched upgrade to 42.7.2, 42.6.1, 42.5.5, 42.4.4, 42.3.9, 42.2.28, 42.2.28.jre7

The patch fixes the inlining of parameters by forcing them all to be serialized as wrapped literals. The SQL in the prior example would be transformed into:

```sql
SELECT -('-1'::int4), ('
WHERE false --')
```

# Workarounds
Do not use the connection property`preferQueryMode=simple`. (*NOTE: If you do not explicitly specify a query mode then you are using the default of `extended` and are not impacted by this issue.*)
references
0
reference_url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2024-1597.json
reference_id
reference_type
scores
0
value 9.8
scoring_system cvssv3
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
url https://access.redhat.com/hydra/rest/securitydata/cve/CVE-2024-1597.json
1
reference_url https://api.first.org/data/v1/epss?cve=CVE-2024-1597
reference_id
reference_type
scores
0
value 0.00476
scoring_system epss
scoring_elements 0.64825
published_at 2026-04-02T12:55:00Z
1
value 0.00476
scoring_system epss
scoring_elements 0.64888
published_at 2026-04-12T12:55:00Z
2
value 0.00476
scoring_system epss
scoring_elements 0.64897
published_at 2026-04-11T12:55:00Z
3
value 0.00476
scoring_system epss
scoring_elements 0.6488
published_at 2026-04-09T12:55:00Z
4
value 0.00476
scoring_system epss
scoring_elements 0.64865
published_at 2026-04-08T12:55:00Z
5
value 0.00476
scoring_system epss
scoring_elements 0.64815
published_at 2026-04-07T12:55:00Z
6
value 0.00476
scoring_system epss
scoring_elements 0.64853
published_at 2026-04-04T12:55:00Z
7
value 0.00508
scoring_system epss
scoring_elements 0.6635
published_at 2026-04-16T12:55:00Z
8
value 0.00508
scoring_system epss
scoring_elements 0.66315
published_at 2026-04-13T12:55:00Z
9
value 0.00508
scoring_system epss
scoring_elements 0.66389
published_at 2026-04-29T12:55:00Z
10
value 0.00508
scoring_system epss
scoring_elements 0.66374
published_at 2026-04-24T12:55:00Z
11
value 0.00508
scoring_system epss
scoring_elements 0.66351
published_at 2026-04-21T12:55:00Z
12
value 0.00508
scoring_system epss
scoring_elements 0.66366
published_at 2026-04-18T12:55:00Z
13
value 0.00508
scoring_system epss
scoring_elements 0.66364
published_at 2026-05-05T12:55:00Z
url https://api.first.org/data/v1/epss?cve=CVE-2024-1597
2
reference_url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-1597
reference_id
reference_type
scores
url https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-1597
3
reference_url https://ftp.suse.com/pub/projects/security/yaml/suse-cvss-scores.yaml
reference_id
reference_type
scores
0
value 9.8
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
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 10.0
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value CRITICAL
scoring_system generic_textual
scoring_elements
url https://github.com/pgjdbc/pgjdbc
5
reference_url https://github.com/pgjdbc/pgjdbc/commit/06abfb78a627277a580d4df825f210e96a4e14ee
reference_id
reference_type
scores
0
value 10.0
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value CRITICAL
scoring_system generic_textual
scoring_elements
url https://github.com/pgjdbc/pgjdbc/commit/06abfb78a627277a580d4df825f210e96a4e14ee
6
reference_url https://github.com/pgjdbc/pgjdbc/commit/93b0fcb2711d9c1e3a2a03134369738a02a58b40
reference_id
reference_type
scores
0
value 10.0
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value CRITICAL
scoring_system generic_textual
scoring_elements
url https://github.com/pgjdbc/pgjdbc/commit/93b0fcb2711d9c1e3a2a03134369738a02a58b40
7
reference_url https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-24rp-q3w6-vc56
reference_id
reference_type
scores
0
value 10
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value 10.0
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
2
value CRITICAL
scoring_system cvssv3.1_qr
scoring_elements
3
value CRITICAL
scoring_system generic_textual
scoring_elements
4
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:Y/T:T/P:M/B:A/M:M/D:R/2024-04-10T04:00:36Z/
url https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-24rp-q3w6-vc56
8
reference_url https://nvd.nist.gov/vuln/detail/CVE-2024-1597
reference_id
reference_type
scores
0
value 10.0
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value CRITICAL
scoring_system generic_textual
scoring_elements
url https://nvd.nist.gov/vuln/detail/CVE-2024-1597
9
reference_url https://www.enterprisedb.com/docs/jdbc_connector/latest/01_jdbc_rel_notes/
reference_id 01_jdbc_rel_notes
reference_type
scores
0
value 10
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:Y/T:T/P:M/B:A/M:M/D:R/2024-04-10T04:00:36Z/
url https://www.enterprisedb.com/docs/jdbc_connector/latest/01_jdbc_rel_notes/
10
reference_url https://bugzilla.redhat.com/show_bug.cgi?id=2266523
reference_id 2266523
reference_type
scores
url https://bugzilla.redhat.com/show_bug.cgi?id=2266523
11
reference_url https://www.enterprisedb.com/docs/security/assessments/cve-2024-1597/
reference_id cve-2024-1597
reference_type
scores
0
value 10
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:Y/T:T/P:M/B:A/M:M/D:R/2024-04-10T04:00:36Z/
url https://www.enterprisedb.com/docs/security/assessments/cve-2024-1597/
12
reference_url https://github.com/advisories/GHSA-24rp-q3w6-vc56
reference_id GHSA-24rp-q3w6-vc56
reference_type
scores
0
value CRITICAL
scoring_system cvssv3.1_qr
scoring_elements
url https://github.com/advisories/GHSA-24rp-q3w6-vc56
13
reference_url https://security.netapp.com/advisory/ntap-20240419-0008/
reference_id ntap-20240419-0008
reference_type
scores
0
value 10
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:Y/T:T/P:M/B:A/M:M/D:R/2024-04-10T04:00:36Z/
url https://security.netapp.com/advisory/ntap-20240419-0008/
14
reference_url https://access.redhat.com/errata/RHSA-2024:1435
reference_id RHSA-2024:1435
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:1435
15
reference_url https://access.redhat.com/errata/RHSA-2024:1436
reference_id RHSA-2024:1436
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:1436
16
reference_url https://access.redhat.com/errata/RHSA-2024:1649
reference_id RHSA-2024:1649
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:1649
17
reference_url https://access.redhat.com/errata/RHSA-2024:1686
reference_id RHSA-2024:1686
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:1686
18
reference_url https://access.redhat.com/errata/RHSA-2024:1797
reference_id RHSA-2024:1797
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:1797
19
reference_url https://access.redhat.com/errata/RHSA-2024:1999
reference_id RHSA-2024:1999
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:1999
20
reference_url https://access.redhat.com/errata/RHSA-2024:2624
reference_id RHSA-2024:2624
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:2624
21
reference_url https://access.redhat.com/errata/RHSA-2024:3313
reference_id RHSA-2024:3313
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:3313
22
reference_url https://access.redhat.com/errata/RHSA-2024:4375
reference_id RHSA-2024:4375
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:4375
23
reference_url https://access.redhat.com/errata/RHSA-2024:4402
reference_id RHSA-2024:4402
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:4402
24
reference_url https://access.redhat.com/errata/RHSA-2024:5056
reference_id RHSA-2024:5056
reference_type
scores
url https://access.redhat.com/errata/RHSA-2024:5056
25
reference_url https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TZQTSMESZD2RJ5XBPSXH3TIQVUW5DIUU/
reference_id TZQTSMESZD2RJ5XBPSXH3TIQVUW5DIUU
reference_type
scores
0
value 10
scoring_system cvssv3.1
scoring_elements CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
1
value Track*
scoring_system ssvc
scoring_elements SSVCv2/E:P/A:Y/T:T/P:M/B:A/M:M/D:R/2024-04-10T04:00:36Z/
url https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TZQTSMESZD2RJ5XBPSXH3TIQVUW5DIUU/
fixed_packages
0
url pkg:apk/alpine/java-postgresql-jdbc@42.6.2-r0?arch=x86_64&distroversion=edge&reponame=community
purl pkg:apk/alpine/java-postgresql-jdbc@42.6.2-r0?arch=x86_64&distroversion=edge&reponame=community
is_vulnerable false
affected_by_vulnerabilities
resource_url http://public2.vulnerablecode.io/packages/pkg:apk/alpine/java-postgresql-jdbc@42.6.2-r0%3Farch=x86_64&distroversion=edge&reponame=community
aliases CVE-2024-1597, GHSA-24rp-q3w6-vc56
risk_score 4.5
exploitability 0.5
weighted_severity 9.0
resource_url http://public2.vulnerablecode.io/vulnerabilities/VCID-6r4u-tem9-vkey
Risk_scorenull
Resource_urlhttp://public2.vulnerablecode.io/packages/pkg:apk/alpine/java-postgresql-jdbc@42.6.2-r0%3Farch=x86_64&distroversion=edge&reponame=community