{"id":"CVE-2022-26520","aliases":["CVE-2022-26520","GHSA-673j-qm5f-xpv8","BIT-POSTGRESQL-JDBC-DRIVER-2022-26520","GHSA-727h-hrw8-jg8q"],"related":[],"kind":"vulnerability","state":"published","title":"pgjdbc Arbitrary File Write Vulnerability","summary":"In pgjdbc before 42.3.3, an attacker (who controls the jdbc URL or properties) can call java.util.logging.FileHandler to write to arbitrary files through the loggerFile and loggerLevel connection properties. An example situation is that an attacker could create an executable JSP file under a Tomcat web root. NOTE: the vendor's position is that there is no pgjdbc vulnerability; instead, it is a vulnerability for any application to use the pgjdbc driver with untrusted connection properties","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In pgjdbc before 42.3.3, an attacker (who controls the jdbc URL or properties) can call java.util.logging.FileHandler to write to arbitrary files through the loggerFile and loggerLevel connection properties. An example situation is that an attacker could create an executable JSP file under a Tomcat web root. NOTE: the vendor's position is that there is no pgjdbc vulnerability; instead, it is a vulnerability for any application to use the pgjdbc driver with untrusted connection properties","source":"cvelist"},{"lang":"en","text":"### 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","format":"markdown","source":"ghsa"},{"lang":"en","text":"In pgjdbc before 42.3.3, an attacker (who controls the jdbc URL or properties) can call java.util.logging.FileHandler to write to arbitrary files through the loggerFile and loggerLevel connection properties. An example situation is that an attacker could create an executable JSP file under a Tomcat web root. NOTE: the vendor's position is that there is no pgjdbc vulnerability; instead, it is a vulnerability for any application to use the pgjdbc driver with untrusted connection properties.","format":"markdown","source":"ghsa"},{"lang":"es","text":"** EN DISPUTA ** En pgjdbc versiones anteriores a 42.3.3, un atacante (que controla la URL o las propiedades de jdbc) puede llamar a java.util.logging.FileHandler para escribir en archivos arbitrarios mediante las propiedades de conexión loggerFile y loggerLevel. Una situación de ejemplo es que un atacante podría crear un archivo JSP ejecutable bajo una root web de Tomcat. NOTA: la posición del proveedor es que no se presenta una vulnerabilidad de pgjdbc; en cambio, es una vulnerabilidad para cualquier aplicación que use el controlador pgjdbc con propiedades de conexión no confiables","source":"nvd"}],"published":"2022-02-16T00:08:18.000Z","modified":"2026-09-10T03:49:16.897Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub","scheme":"rating","rating":"MEDIUM"},{"scorer":"GitHub","scheme":"rating","rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:2.0","vector":"AV:N/AC:L/Au:N/C:P/I:P/A:P","score":7.5,"rating":"HIGH"},{"scorer":"Bitnami Vulnerability Database","scheme":"rating","rating":"CRITICAL"}],"cwes":[],"affected":[{"ranges":[{"version":"n/a","status":"affected"}],"source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"42.1.0","status":"affected","fixed":"42.3.3"}],"ecosystem":"Maven","package":"org.postgresql:postgresql","purl":"pkg:maven/org.postgresql/postgresql","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"42.1.0","status":"affected","fixed":"42.3.3"}],"ecosystem":"Maven","package":"org.postgresql:postgresql","purl":"pkg:maven/org.postgresql/postgresql","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"42.1.0","lastAffected":"42.1.4"},{"status":"affected","introduced":"42.3.0","fixed":"42.3.3"}],"vendor":"postgresql","product":"postgresql_jdbc_driver","cpe":"cpe:2.3:a:postgresql:postgresql_jdbc_driver:*:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"status":"affected","version":"10.0"},{"status":"affected","version":"11.0"}],"vendor":"debian","product":"debian_linux","cpe":"cpe:2.3:o:debian:debian_linux:10.0:*:*:*:*:*:*:*","source":"nvd"},{"ranges":[{"type":"semver","introduced":"42.1.0","status":"affected","fixed":"42.1.5"},{"type":"semver","introduced":"42.3.0","status":"affected","fixed":"42.3.3"}],"ecosystem":"Bitnami","package":"postgresql-jdbc-driver","purl":"pkg:bitnami/postgresql-jdbc-driver","source":"bitnami"}],"references":[{"url":"https://jdbc.postgresql.org/documentation/changelog.html#version_42.3.3","tags":["advisory","release-notes","vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-673j-qm5f-xpv8","tags":["advisory","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/pgjdbc/pgjdbc/pull/2454/commits/017b929977b4f85795f9ad2fa5de6e80978b8ccc","tags":["advisory","patch","third-party-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://jdbc.postgresql.org/documentation/head/tomcat.html","tags":["advisory","vendor-advisory","web","x-refsource-misc","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://www.debian.org/security/2022/dsa-5196","tags":["advisory","third-party-advisory","vendor-advisory","web","x-refsource-debian","x-transferred"],"sources":["cvelist","ghsa","nvd","bitnami"]},{"url":"https://github.com/pgjdbc/pgjdbc/commit/f6d47034a4ce292e1a659fa00963f6f713117064","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/pgjdbc/pgjdbc","tags":["package"],"sources":["ghsa"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-26520","tags":["advisory","web"],"sources":["ghsa","bitnami"]}],"credits":[],"assigner":"mitre","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-26520","url":"https://www.cve.org/CVERecord?id=CVE-2022-26520","licence":"CVE Terms of Use","modified":"2024-08-03T05:03:32.964Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-673j-qm5f-xpv8","url":"https://github.com/advisories/GHSA-673j-qm5f-xpv8","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:16.897Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-727h-hrw8-jg8q","url":"https://github.com/advisories/GHSA-727h-hrw8-jg8q","licence":"CC-BY-4.0","modified":"2026-09-10T03:49:13.124Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-26520","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-26520","licence":"Public domain","modified":"2026-06-17T04:35:20.700Z"},{"source":"bitnami","name":"Bitnami Vulnerability Database","id":"BIT-POSTGRESQL-JDBC-DRIVER-2022-26520","url":"https://osv.dev/vulnerability/BIT-POSTGRESQL-JDBC-DRIVER-2022-26520","licence":"Apache-2.0","modified":"2026-09-08T08:47:05.736Z"}],"updatedAt":"2026-11-25T22:58:10.026Z","epss":{"score":0.02999,"percentile":0.87722,"date":"2026-12-01T12:00:22.000Z"}}