GHSA-673j-qm5f-xpv8: Postgresql Pgjdbc Arbitrary File Write Vulnerability Vulnerability
MODERATEGHSA-673j-qm5f-xpv8 is a MODERATE pgjdbc arbitrary file write vulnerability vulnerability (General Security Weakness) affecting Postgresql libraries in the Maven ecosystem. The issue involves pgjdbc arbitrary file write vulnerability. Remediation is available by upgrading affected packages to version 42.3.3.
GHSA-673j-qm5f-xpv8 at a Glance
How to Fix GHSA-673j-qm5f-xpv8
To remediate this vulnerability, upgrade all affected Postgresql dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.3</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.postgresql
How to Check if You Are Affected
To determine whether your Java application is affected by GHSA-673j-qm5f-xpv8, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.postgresql
Analyze the terminal output to locate any version of Postgresql in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 42.3.3), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.postgresql command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under General Security Weakness. In Postgresql, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-673j-qm5f-xpv8 Affected Postgresql Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.postgresql:postgresql
|
Maven |
≥ 42.1.0
< 42.3.3
|
42.3.3
|
References
Frequently Asked Questions
What is GHSA-673j-qm5f-xpv8?
Which Postgresql versions are affected?
What version fixes GHSA-673j-qm5f-xpv8?
Is postgresql affected?
What CWE is associated with GHSA-673j-qm5f-xpv8?
How can I check Maven dependencies for GHSA-673j-qm5f-xpv8?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-673j-qm5f-xpv8",
"modified" : "2024-01-22T19:35:00Z",
"published" : "2022-02-16T00:08:18Z",
"aliases" : [ ],
"summary" : "pgjdbc Arbitrary File Write Vulnerability",
"details" : "### Overview\nThe connection properties for configuring a pgjdbc connection are not meant to be exposed to an unauthenticated attacker. While allowing an attacker to specify arbitrary connection properties could lead to a compromise of a system, that's a defect of an application that allows unauthenticated attackers that level of control.\n\nIt's not the job of the pgjdbc driver to decide whether a given log file location is acceptable. End user applications that use the pgjdbc driver must ensure that filenames are valid and restrict unauthenticated attackers from being able to supply arbitrary values. That's not specific to the pgjdbc driver either, it would be true for any library that can write to the application's local file system.\n\nWhile we do not consider this a security issue with the driver, we have decided to remove the loggerFile and loggerLevel connection properties in the next release of the driver. Removal of those properties does not make exposing the JDBC URL or connection properties to an attacker safe and we continue to suggest that applications do not allow untrusted users to specify arbitrary connection properties. We are removing them to prevent misuse and their functionality can be delegated to java.util.logging.\n\nIf you identify an application that allows remote users to specify a complete JDBC URL or properties without validating it's contents, we encourage you to notify the application owner as that may be a security defect in that specific application.\n\n### Impact\nIt is possible to specify an arbitrary filename in the loggerFileName connection parameter\n\"jdbc:postgresql://localhost:5432/test?user=test&password=test&loggerLevel=DEBUG&loggerFile=./blah.jsp&<%Runtime.getRuntime().exec(request.getParameter(\\\"i\\\"));%>\"\n\nThis creates a valid JSP file which could lead to a Remote Code Execution \n\n### Patches\nLoggerFile implementation has been removed and will be ignored by the driver, fixed in 42.3.3\n\n### Workarounds\nsanitize the inputs to the driver\n\nReported by Allan Lou v3ged0ge@gmail.com",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.postgresql:postgresql"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "42.1.0"
}, {
"fixed" : "42.3.3"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-673j-qm5f-xpv8"
}, {
"type" : "WEB",
"url" : "https://github.com/pgjdbc/pgjdbc/commit/f6d47034a4ce292e1a659fa00963f6f713117064"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pgjdbc/pgjdbc"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-02-16T00:08:18Z",
"nvd_published_at" : null
}
}