{"id":"CVE-2022-31197","aliases":["ALPINE-CVE-2022-31197","ALSA-2023:0318","BIT-postgresql-jdbc-driver-2022-31197","CLSA-2025-1764720464","DEBIAN-CVE-2022-31197","DLA-3140-1","DLA-3995-1","EUVD-2022-6614","GHSA-24rp-q3w6-vc56","GHSA-562r-vg33-8x8h","GHSA-98qh-xjc8-98pq","GHSA-r38f-c4h4-hqq2","OESA-2022-1835","RHLW-2026-b44d1f7dac7a0d3d","RHSA-2023:0318","RLSA-2023:0318","SUSE-SU-2022:3537-1","SUSE-SU-2022:3541-1","SUSE-SU-2022:3613-1","SUSE-SU-2022:3705-1","UBUNTU-CVE-2022-31197","openSUSE-SU-2024:12369-1"],"status":"published","title":"SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","severity":{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.02355,"percentile":0.83875,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-89"],"published":"2022-08-03T00:00:00Z","modified":"2026-11-03T07:30:51Z","fixes":[{"ecosystem":"Maven","package":"org.postgresql:postgresql","fixed_in":["42.2.26","42.4.1","42.3.7"],"sources":["ghsa","osv"]},{"ecosystem":"Alpine:v3.16","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.17","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.18","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.19","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.20","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.21","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.22","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.23","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"Alpine:v3.24","package":"java-postgresql-jdbc","fixed_in":["42.4.2-r0"],"sources":["osv"]},{"ecosystem":"AlmaLinux:9","package":"postgresql-jdbc","fixed_in":["42.2.18-6.el9_1"],"sources":["osv"]},{"ecosystem":"Bitnami","package":"postgresql-jdbc-driver","fixed_in":["42.2.26","42.3.7"],"sources":["osv"]},{"ecosystem":"Debian:12","package":"libpgjava","fixed_in":["42.4.1-1"],"sources":["osv"]},{"ecosystem":"Debian:13","package":"libpgjava","fixed_in":["42.4.1-1"],"sources":["osv"]},{"ecosystem":"Debian:14","package":"libpgjava","fixed_in":["42.4.1-1"],"sources":["osv"]},{"ecosystem":"Debian:10","package":"libpgjava","fixed_in":["42.2.5-2+deb10u2"],"sources":["osv"]},{"ecosystem":"openEuler:20.03-LTS-SP1","package":"postgresql-jdbc","fixed_in":["42.4.1-1.oe1"],"sources":["osv"]},{"ecosystem":"openEuler:20.03-LTS-SP3","package":"postgresql-jdbc","fixed_in":["42.4.1-1.oe1"],"sources":["osv"]},{"ecosystem":"openEuler:22.03-LTS","package":"postgresql-jdbc","fixed_in":["42.4.1-1.oe2203"],"sources":["osv"]},{"ecosystem":"Red Hat:enterprise_linux:9::appstream","package":"postgresql-jdbc","fixed_in":["0:42.2.18-6.el9_1"],"sources":["osv"]},{"ecosystem":"Rocky Linux:9","package":"postgresql-jdbc","fixed_in":["0:42.2.18-6.el9_1"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Module for Server Applications 15 SP4","package":"postgresql-jdbc","fixed_in":["42.2.25-150400.3.6.1"],"sources":["osv"]},{"ecosystem":"openSUSE:Leap 15.4","package":"postgresql-jdbc","fixed_in":["42.2.25-150400.3.6.1"],"sources":["osv"]},{"ecosystem":"SUSE:OpenStack Cloud 9","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:OpenStack Cloud Crowbar 9","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 12 SP4","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP2-BCL","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP3-BCL","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP4-LTSS","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP5","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 12 SP5","package":"postgresql-jdbc","fixed_in":["9.4-3.6.3"],"sources":["osv"]},{"ecosystem":"SUSE:Manager Server Module 4.2","package":"postgresql-jdbc","fixed_in":["42.2.25-150300.3.8.1"],"sources":["osv"]},{"ecosystem":"SUSE:Linux Enterprise Module for Server Applications 15 SP3","package":"postgresql-jdbc","fixed_in":["42.2.25-150300.3.8.1"],"sources":["osv"]},{"ecosystem":"openSUSE:Leap 15.3","package":"postgresql-jdbc","fixed_in":["42.2.25-150300.3.8.1"],"sources":["osv"]},{"ecosystem":"SUSE:Manager Server Module 4.1","package":"postgresql-jdbc","fixed_in":["42.2.10-150200.3.11.1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.26"}]}]},{"source":"ghsa","ecosystem":"Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"42.4.0"},{"fixed":"42.4.1"}]}]},{"source":"ghsa","ecosystem":"Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"42.3.0"},{"fixed":"42.3.7"}]}]},{"source":"osv","ecosystem":"Alpine:v3.16","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.17","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.18","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.19","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.20","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.21","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.22","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.23","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"Alpine:v3.24","package":"java-postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.2-r0"}]}]},{"source":"osv","ecosystem":"AlmaLinux:9","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.18-6.el9_1"}]}]},{"source":"osv","ecosystem":"Bitnami","package":"postgresql-jdbc-driver","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"42.2.26"},{"introduced":"42.3.0"},{"fixed":"42.3.7"}]},{"type":"SEMVER","events":[{"introduced":"42.4.0"},{"last_affected":"42.4.0"}]}]},{"source":"osv","ecosystem":"TuxCare:Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"42.2.16"},{"fixed":"42.2.16-tuxcare.2"}]}],"versions":["42.2.16","42.2.16-tuxcare.1"],"bundled":2},{"source":"osv","ecosystem":"Debian:12","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.1-1"}]}]},{"source":"osv","ecosystem":"Debian:13","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.1-1"}]}]},{"source":"osv","ecosystem":"Debian:14","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.1-1"}]}]},{"source":"osv","ecosystem":"Debian:10","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.5-2+deb10u2"}]}],"versions":["42.2.5-2","42.2.5-2+deb10u1"]},{"source":"osv","ecosystem":"Debian:11","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.15-1+deb11u2"}]}],"versions":["42.2.15-1","42.2.15-1+deb11u1"],"bundled":3},{"source":"osv","ecosystem":"Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.26"}]}],"versions":["42.0.0","42.0.0.jre6","42.0.0.jre7","42.1.0","42.1.0.jre7","42.1.1","42.1.1.jre6","42.1.1.jre7","42.1.2","42.1.2.jre6","42.1.2.jre7","42.1.3","42.1.3.jre6","42.1.3.jre7","42.1.4","42.1.4.jre6","42.1.4.jre7","42.2.0","42.2.0.jre6","42.2.0.jre7","42.2.1","42.2.1.jre6","42.2.1.jre7","42.2.10","42.2.10.jre6","42.2.10.jre7","42.2.11","42.2.11.jre6","42.2.11.jre7","42.2.12","42.2.12.jre6","42.2.12.jre7","42.2.13","42.2.13.jre6","42.2.13.jre7","42.2.14","42.2.14.jre6","42.2.14.jre7","42.2.15","42.2.15.jre6","42.2.15.jre7","42.2.16","42.2.16.jre6","42.2.16.jre7","42.2.17","42.2.17.jre6","42.2.17.jre7","42.2.18","42.2.18.jre6","42.2.18.jre7","42.2.19","42.2.19.jre6","42.2.19.jre7","42.2.2","42.2.2.jre6","42.2.2.jre7","42.2.20","42.2.20.jre6","42.2.20.jre7","42.2.21","42.2.21.jre6","42.2.21.jre7","42.2.22","42.2.22.jre6","42.2.22.jre7","42.2.23","42.2.23.jre6","42.2.23.jre7","42.2.24","42.2.24.jre6","42.2.24.jre7","42.2.25","42.2.25.jre6","42.2.25.jre7","42.2.3","42.2.3.jre6","42.2.3.jre7","42.2.4","42.2.4.jre6","42.2.4.jre7","42.2.5","42.2.5.jre6","42.2.5.jre7","42.2.6","42.2.6.jre6","42.2.6.jre7","42.2.7","42.2.7.jre6","42.2.7.jre7","42.2.8","42.2.8.jre6","42.2.8.jre7","42.2.9","42.2.9.jre6","42.2.9.jre7","9.2-1002-jdbc4","9.2-1003-jdbc3","9.2-1003-jdbc4","9.2-1004-jdbc3","9.2-1004-jdbc4","9.2-1004-jdbc41","9.3-1100-jdbc3","9.3-1100-jdbc4","9.3-1100-jdbc41","9.3-1101-jdbc3","9.3-1101-jdbc4","9.3-1101-jdbc41","9.3-1102-jdbc3","9.3-1102-jdbc4","9.3-1102-jdbc41","9.3-1103-jdbc3","9.3-1103-jdbc4","9.3-1103-jdbc41","9.3-1104-jdbc4","9.3-1104-jdbc41","9.4-1200-jdbc4","9.4-1200-jdbc41","9.4-1201-jdbc4","9.4-1201-jdbc41","9.4-1202-jdbc4","9.4-1202-jdbc41","9.4-1202-jdbc42","9.4-1203-jdbc4","9.4-1203-jdbc41","9.4-1203-jdbc42","9.4-1204-jdbc4","9.4-1204-jdbc41","9.4-1204-jdbc42","9.4-1205-jdbc4","9.4-1205-jdbc41","9.4-1205-jdbc42","9.4-1206-jdbc4","9.4-1206-jdbc41","9.4-1206-jdbc42","9.4.1207","9.4.1207.jre6","9.4.1207.jre7","9.4.1208","9.4.1208.jre6","9.4.1208.jre7","9.4.1209","9.4.1209.jre6","9.4.1209.jre7","9.4.1210","9.4.1210.jre6","9.4.1210.jre7","9.4.1211","9.4.1211.jre6","9.4.1211.jre7","9.4.1212","9.4.1212.jre6","9.4.1212.jre7"]},{"source":"osv","ecosystem":"Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"42.4.0"},{"fixed":"42.4.1"}]}],"versions":["42.4.0"]},{"source":"osv","ecosystem":"Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"42.3.0"},{"fixed":"42.3.7"}]}],"versions":["42.3.0","42.3.1","42.3.2","42.3.3","42.3.4","42.3.5","42.3.6"]},{"source":"osv","ecosystem":"openEuler:20.03-LTS-SP1","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.1-1.oe1"}]}]},{"source":"osv","ecosystem":"openEuler:20.03-LTS-SP3","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.1-1.oe1"}]}]},{"source":"osv","ecosystem":"openEuler:22.03-LTS","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.4.1-1.oe2203"}]}]},{"source":"osv","ecosystem":"Red Hat Lightwell:Maven","package":"org.postgresql:postgresql","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.3.3.rhlw-00006"}]}],"versions":["42.0.0","42.0.0.jre6","42.0.0.jre7","42.1.0","42.1.0.jre7","42.1.1","42.1.1.jre6","42.1.1.jre7","42.1.2","42.1.2.jre6","42.1.2.jre7","42.1.3","42.1.3.jre6","42.1.3.jre7","42.1.4","42.1.4.jre6","42.1.4.jre7","42.2.0","42.2.0.jre6","42.2.0.jre7","42.2.1","42.2.1.jre6","42.2.1.jre7","42.2.10","42.2.10.jre6","42.2.10.jre7","42.2.11","42.2.11.jre6","42.2.11.jre7","42.2.12","42.2.12.jre6","42.2.12.jre7","42.2.13","42.2.13.jre6","42.2.13.jre7","42.2.14","42.2.14.jre6","42.2.14.jre7","42.2.15","42.2.15.jre6","42.2.15.jre7","42.2.16","42.2.16.jre6","42.2.16.jre7","42.2.17","42.2.17.jre6","42.2.17.jre7","42.2.18","42.2.18.jre6","42.2.18.jre7","42.2.19","42.2.19.jre6","42.2.19.jre7","42.2.2","42.2.2.jre6","42.2.2.jre7","42.2.20","42.2.20.jre6","42.2.20.jre7","42.2.21","42.2.21.jre6","42.2.21.jre7","42.2.22","42.2.22.jre6","42.2.22.jre7","42.2.23","42.2.23.jre6","42.2.23.jre7","42.2.24","42.2.24.jre6","42.2.24.jre7","42.2.25","42.2.25.jre6","42.2.25.jre7","42.2.26","42.2.26.jre6","42.2.26.jre7","42.2.27","42.2.27.jre6","42.2.27.jre7","42.2.28","42.2.28.jre7","42.2.29","42.2.29.jre7","42.2.3","42.2.3.jre6","42.2.3.jre7","42.2.4","42.2.4.jre6","42.2.4.jre7","42.2.5","42.2.5.jre6","42.2.5.jre7","42.2.6","42.2.6.jre6","42.2.6.jre7","42.2.7","42.2.7.jre6","42.2.7.jre7","42.2.8","42.2.8.jre6","42.2.8.jre7","42.2.9","42.2.9.jre6","42.2.9.jre7","42.3.0","42.3.1","42.3.2","42.3.3","9.2-1002-jdbc4","9.2-1003-jdbc3","9.2-1003-jdbc4","9.2-1004-jdbc3","9.2-1004-jdbc4","9.2-1004-jdbc41","9.3-1100-jdbc3","9.3-1100-jdbc4","9.3-1100-jdbc41","9.3-1101-jdbc3","9.3-1101-jdbc4","9.3-1101-jdbc41","9.3-1102-jdbc3","9.3-1102-jdbc4","9.3-1102-jdbc41","9.3-1103-jdbc3","9.3-1103-jdbc4","9.3-1103-jdbc41","9.3-1104-jdbc4","9.3-1104-jdbc41","9.4-1200-jdbc4","9.4-1200-jdbc41","9.4-1201-jdbc4","9.4-1201-jdbc41","9.4-1202-jdbc4","9.4-1202-jdbc41","9.4-1202-jdbc42","9.4-1203-jdbc4","9.4-1203-jdbc41","9.4-1203-jdbc42","9.4-1204-jdbc4","9.4-1204-jdbc41","9.4-1204-jdbc42","9.4-1205-jdbc4","9.4-1205-jdbc41","9.4-1205-jdbc42","9.4-1206-jdbc4","9.4-1206-jdbc41","9.4-1206-jdbc42","9.4.1207","9.4.1207.jre6","9.4.1207.jre7","9.4.1208","9.4.1208.jre6","9.4.1208.jre7","9.4.1209","9.4.1209.jre6","9.4.1209.jre7","9.4.1210","9.4.1210.jre6","9.4.1210.jre7","9.4.1211","9.4.1211.jre6","9.4.1211.jre7","9.4.1212","9.4.1212.jre6","9.4.1212.jre7"],"bundled":4},{"source":"osv","ecosystem":"Red Hat:enterprise_linux:9::appstream","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0:42.2.18-6.el9_1"}]}]},{"source":"osv","ecosystem":"Rocky Linux:9","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"0:42.2.18-6.el9_1"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Module for Server Applications 15 SP4","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.25-150400.3.6.1"}]}]},{"source":"osv","ecosystem":"openSUSE:Leap 15.4","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.25-150400.3.6.1"}]}]},{"source":"osv","ecosystem":"SUSE:OpenStack Cloud 9","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:OpenStack Cloud Crowbar 9","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 12 SP4","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Server 12 SP2-BCL","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Server 12 SP3-BCL","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Server 12 SP4-LTSS","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Server 12 SP5","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 12 SP5","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"9.4-3.6.3"}]}]},{"source":"osv","ecosystem":"SUSE:Manager Server Module 4.2","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.25-150300.3.8.1"}]}]},{"source":"osv","ecosystem":"SUSE:Linux Enterprise Module for Server Applications 15 SP3","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.25-150300.3.8.1"}]}]},{"source":"osv","ecosystem":"openSUSE:Leap 15.3","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.25-150300.3.8.1"}]}]},{"source":"osv","ecosystem":"SUSE:Manager Server Module 4.1","package":"postgresql-jdbc","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"42.2.10-150200.3.11.1"}]}]},{"source":"osv","ecosystem":"Ubuntu:14.04:LTS","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["9.2-1002-1"]},{"source":"osv","ecosystem":"Ubuntu:16.04:LTS","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["9.2-1002-1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:18.04:LTS","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["9.4.1212-1","9.4.1212-1ubuntu0.1~esm1"]},{"source":"osv","ecosystem":"Ubuntu:Pro:20.04:LTS","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["42.2.6-1","42.2.8-1","42.2.9-1","42.2.10-1","42.2.10-1ubuntu0.1~esm1"]},{"source":"osv","ecosystem":"Ubuntu:22.04:LTS","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["42.2.23-1","42.2.24-1","42.3.1-1","42.3.2-1","42.3.3-1"]},{"source":"osv","ecosystem":"Ubuntu:24.04:LTS","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["42.5.4-1","42.6.0-2","42.7.0-1","42.7.1-1","42.7.2-1"]},{"source":"osv","ecosystem":"Ubuntu:25.10","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["42.7.5-1","42.7.5-2","42.7.7-1"]},{"source":"osv","ecosystem":"Ubuntu:26.10","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["42.7.10-1","42.7.11-1","42.7.12-1","42.7.13-1"]},{"source":"osv","ecosystem":"Ubuntu:26.04:LTS","package":"libpgjava","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["42.7.7-1","42.7.8-1","42.7.8-2","42.7.9-1","42.7.10-1"]}],"products":[{"vendor":"debian","product":"debian_linux"},{"vendor":"fedoraproject","product":"fedora"},{"vendor":"pgjdbc","product":"pgjdbc"},{"vendor":"postgresql","product":"postgresql_jdbc_driver"}],"references":[{"url":"https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-r38f-c4h4-hqq2","tags":["x_transferred","Exploit","Third Party Advisory","advisory","web","article","report"]},{"url":"https://github.com/pgjdbc/pgjdbc/commit/739e599d52ad80f8dcd6efedc6157859b1a9d637","tags":["x_transferred","Patch","Third Party Advisory","advisory","fix","web","report"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP/","tags":["vendor-advisory","x_transferred","web","advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S/","tags":["vendor-advisory","x_transferred","web","advisory"]},{"url":"https://lists.debian.org/debian-lts-announce/2022/10/msg00009.html","tags":["mailing-list","x_transferred","Mailing List","Third Party Advisory","advisory","article","web"]},{"url":"https://lists.debian.org/debian-lts-announce/2024/12/msg00017.html","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-31197","tags":["web","advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP","tags":["web"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S","tags":["web"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/I6WHUADTZBBQLVHO4YG4XCWDGWBT4LRP","tags":["web"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UTFE6SV33P5YYU2GNTQZQKQRVR3GYE4S","tags":["web"]},{"url":"https://github.com/advisories/GHSA-r38f-c4h4-hqq2","tags":["advisory"]},{"url":"https://security.alpinelinux.org/vuln/CVE-2022-31197","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2023:0318","tags":["advisory"]},{"url":"https://access.redhat.com/security/cve/CVE-2022-31197","tags":["report"]},{"url":"https://bugzilla.redhat.com/2129428","tags":["report"]},{"url":"https://errata.almalinux.org/9/ALSA-2023-0318.html","tags":["advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/31xxx/CVE-2022-31197.json","tags":["advisory"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2022-31197","tags":["advisory"]},{"url":"https://github.com/pgjdbc/pgjdbc","tags":["package"]},{"url":"https://www.openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2022-1835","tags":["advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/41xxx/CVE-2022-41946.json","tags":["advisory"]},{"url":"https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-562r-vg33-8x8h","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2022-41946","tags":["advisory"]},{"url":"https://github.com/pgjdbc/pgjdbc/commit/9008dc9aade6dbfe4efafcd6872ebc55f4699cf5","tags":["fix"]},{"url":"https://github.com/advisories/GHSA-562r-vg33-8x8h","tags":["advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/1xxx/CVE-2024-1597.json","tags":["advisory"]},{"url":"https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-24rp-q3w6-vc56","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2024-1597","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-24rp-q3w6-vc56","tags":["advisory"]},{"url":"https://github.com/pgjdbc/pgjdbc/releases/tag/REL42.7.11","tags":["web"]},{"url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42198.json","tags":["web"]},{"url":"https://access.redhat.com/errata/RHSA-2026:19098","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:22304","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:24348","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:25030","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:52928","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:52929","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:52930","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:52978","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:54532","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:59277","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:59278","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:66488","tags":["advisory"]},{"url":"https://access.redhat.com/errata/RHSA-2026:66545","tags":["advisory"]},{"url":"https://access.redhat.com/security/cve/CVE-2026-42198","tags":["advisory"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42198.json","tags":["advisory"]},{"url":"https://github.com/pgjdbc/pgjdbc/security/advisories/GHSA-98qh-xjc8-98pq","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42198","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-98qh-xjc8-98pq","tags":["advisory"]},{"url":"https://access.redhat.com/security/updates/classification/#moderate","tags":["article"]},{"url":"https://bugzilla.redhat.com/show_bug.cgi?id=2129428","tags":["report"]},{"url":"https://security.access.redhat.com/data/csaf/v2/advisories/2023/rhsa-2023_0318.json","tags":["advisory"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2022-31197","tags":["advisory","report"]},{"url":"https://errata.rockylinux.org/RLSA-2023:0318","tags":["advisory"]},{"url":"https://www.suse.com/support/update/announcement/2022/suse-su-20223537-1/","tags":["advisory"]},{"url":"https://bugzilla.suse.com/1202170","tags":["report"]},{"url":"https://www.suse.com/security/cve/CVE-2022-31197","tags":["web"]},{"url":"https://www.suse.com/support/update/announcement/2022/suse-su-20223541-1/","tags":["advisory"]},{"url":"https://www.suse.com/support/update/announcement/2022/suse-su-20223613-1/","tags":["advisory"]},{"url":"https://www.suse.com/support/update/announcement/2022/suse-su-20223705-1/","tags":["advisory"]},{"url":"https://ubuntu.com/security/CVE-2022-31197","tags":["report"]},{"url":"","tags":["advisory"]}],"sources":{"cve":[{"id":"CVE-2022-31197","title":"SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2022-08-03T00:00:00Z","modified":"2025-11-03T21:46:18.502Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high","assessor":"cna"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:34:34.940806Z"}],"euvd":[{"id":"EUVD-2022-6614","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2022-08-03T00:00:00Z","modified":"2025-11-03T21:46:18Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T19:49:31.25882Z"}],"ghsa":[{"id":"GHSA-r38f-c4h4-hqq2","title":"PostgreSQL JDBC Driver SQL Injection in ResultSet.refreshRow() with malicious column names","description":"### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nThe PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user.\n\nUser applications that do not invoke the `ResultSet.refreshRow()` method are not impacted.\n\nUser application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet.\n\nFor example:\n\n```sql\nCREATE TABLE refresh_row_example (\n  id     int PRIMARY KEY,\n  \"1 FROM refresh_row_example; SELECT pg_sleep(10); SELECT * \" int\n);\n```\n\nThis example has a table with two columns. The name of the second column is crafted to contain a statement terminator followed by additional SQL. Invoking the `ResultSet.refreshRow()` on a ResultSet that queried this table, e.g. `SELECT * FROM refresh_row`, would cause the additional SQL commands such as the `SELECT pg_sleep(10)` invocation to be executed.\n\nAs the multi statement command would contain multiple results, it would not be possible for the attacker to get data directly out of this approach as the `ResultSet.refreshRow()` method would throw an exception. However, the attacker could execute any arbitrary SQL including inserting the data into another table that could then be read or any other DML / DDL statement.\n\nNote that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nYes, versions 42.2.26, 42.3.7, and 42.4.1 have been released with a fix.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nCheck that you are not using the `ResultSet.refreshRow()` method.\n\nIf you are, ensure that the code that executes that method does not connect to a database that is controlled by an unauthenticated or malicious user. If your application only connects to its own database with a fixed schema with no DDL permissions, then you will not be affected by this vulnerability as it requires a maliciously crafted schema.","status":"published","published":"2022-08-06T05:51:38Z","modified":"2025-11-04T16:36:10Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:39:05.278442Z"}],"nvd":[{"id":"CVE-2022-31197","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2022-08-03T19:15:08.63Z","modified":"2026-06-17T04:45:00.76Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high","assessor":"secondary"},{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high","assessor":"primary"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T14:07:24.39467Z"}],"osv":[{"id":"ALPINE-CVE-2022-31197","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2022-08-03T19:15:08.63Z","modified":"2026-11-03T07:30:51.831941035Z","cvss":[{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-03T07:50:01.054176Z"},{"id":"CVE-2022-31197","title":"SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2022-08-03T00:00:00Z","modified":"2026-10-28T10:28:06.738375554Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T15:44:25.516981Z"},{"id":"GHSA-r38f-c4h4-hqq2","title":"PostgreSQL JDBC Driver SQL Injection in ResultSet.refreshRow() with malicious column names","description":"### Impact\n_What kind of vulnerability is it? Who is impacted?_\n\nThe PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user.\n\nUser applications that do not invoke the `ResultSet.refreshRow()` method are not impacted.\n\nUser application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet.\n\nFor example:\n\n```sql\nCREATE TABLE refresh_row_example (\n  id     int PRIMARY KEY,\n  \"1 FROM refresh_row_example; SELECT pg_sleep(10); SELECT * \" int\n);\n```\n\nThis example has a table with two columns. The name of the second column is crafted to contain a statement terminator followed by additional SQL. Invoking the `ResultSet.refreshRow()` on a ResultSet that queried this table, e.g. `SELECT * FROM refresh_row`, would cause the additional SQL commands such as the `SELECT pg_sleep(10)` invocation to be executed.\n\nAs the multi statement command would contain multiple results, it would not be possible for the attacker to get data directly out of this approach as the `ResultSet.refreshRow()` method would throw an exception. However, the attacker could execute any arbitrary SQL including inserting the data into another table that could then be read or any other DML / DDL statement.\n\nNote that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nYes, versions 42.2.26, 42.3.7, and 42.4.1 have been released with a fix.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nCheck that you are not using the `ResultSet.refreshRow()` method.\n\nIf you are, ensure that the code that executes that method does not connect to a database that is controlled by an unauthenticated or malicious user. If your application only connects to its own database with a fixed schema with no DDL permissions, then you will not be affected by this vulnerability as it requires a maliciously crafted schema.","status":"published","published":"2022-08-06T05:51:38Z","modified":"2026-09-10T03:49:45.309500024Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"cwes":["CWE-89"],"updated_at":"2026-11-02T15:46:55.122811Z"},{"id":"OESA-2022-1835","title":"postgresql-jdbc security update","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. Is an open source JDBC driver written in Pure Java (Type 4), and communicates in the PostgreSQL native network protocol.\r\n\r\nSecurity Fix(es):\r\n\r\nPostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application\u0026apos;s JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who\u0026apos;s column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application\u0026apos;s JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.(CVE-2022-31197)","status":"published","published":"2022-08-13T11:05:06Z","modified":"2026-08-18T01:17:09.038030269Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:52:39.528805Z"},{"id":"RHLW-2026-b44d1f7dac7a0d3d","title":"Lightwell Security Advisory: postgresql 42.3.3.rhlw-00006","description":"Red Hat Lightwell has released org.postgresql:postgresql 42.3.3.rhlw-00006 with backported fixes for CVE-2022-31197, CVE-2022-41946, CVE-2024-1597, and CVE-2026-42198.\n\nCVE-2022-31197: SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc\n\nCVE-2022-41946: TemporaryFolder on unix-like systems does not limit access to created files in pgjdbc\n\nCVE-2024-1597: pgjdbc SQL Injection via line comment generation\n\nCVE-2026-42198: pgjdbc: Unbounded PBKDF2 iterations in SCRAM authentication allows CPU exhaustion DoS\n\nThis patched artifact is a drop-in replacement for org.postgresql:postgresql 42.3.3 from Maven Central.","status":"published","published":"2026-10-08T00:00:00Z","modified":"2026-10-27T04:13:04.315085632Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:52:58.636919Z"},{"id":"RHSA-2023:0318","title":"Red Hat Security Advisory: postgresql-jdbc security update","status":"published","published":"2024-09-16T09:53:51Z","modified":"2026-10-02T10:02:31Z","cvss":[{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:53:10.611604Z"},{"id":"RLSA-2023:0318","title":"Moderate: postgresql-jdbc security update","description":"PostgreSQL is an advanced object-relational database management system. The postgresql-jdbc package includes the .jar files needed for Java programs to access a PostgreSQL database.\n\nSecurity Fix(es):\n\n* postgresql: SQL Injection in ResultSet.refreshRow() with malicious column names (CVE-2022-31197)\n\nFor more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section.","status":"published","published":"2023-01-23T14:30:09Z","modified":"2026-02-04T09:30:11.423368Z","cvss":[{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T15:53:24.322216Z"},{"id":"UBUNTU-CVE-2022-31197","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2022-08-03T19:15:00Z","modified":"2026-10-17T12:56:21.771961686Z","cvss":[{"version":"3.1","score":7.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"},{"version":"3.1","score":8,"vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","level":"high"}],"updated_at":"2026-11-02T16:53:53.899276Z"},{"id":"ALSA-2023:0318","title":"Moderate: postgresql-jdbc security update","description":"PostgreSQL is an advanced object-relational database management system. The postgresql-jdbc package includes the .jar files needed for Java programs to access a PostgreSQL database.\n\nSecurity Fix(es):\n\n* postgresql: SQL Injection in ResultSet.refreshRow() with malicious column names (CVE-2022-31197)\n\nFor more details about the security issue(s), including the impact, a CVSS score, acknowledgments, and other related information, refer to the CVE page(s) listed in the References section.","status":"published","published":"2023-01-23T00:00:00Z","modified":"2026-10-29T11:30:08.848707309Z","updated_at":"2026-11-02T15:27:51.655726Z"},{"id":"BIT-postgresql-jdbc-driver-2022-31197","title":"SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2024-03-06T11:02:11.474Z","modified":"2026-09-08T08:46:22.878689353Z","updated_at":"2026-11-02T15:28:34.724063Z"},{"id":"CLSA-2025-1764720464","title":"TuxCare security update for org.postgresql:postgresql (2 CVEs)","description":"TuxCare rebuilt org.postgresql:postgresql to address 2 CVEs. Fixed in 42.2.16-tuxcare.2.","status":"published","published":"2026-08-04T14:52:06Z","modified":"2026-10-15T09:46:14.796533535Z","updated_at":"2026-11-02T15:43:42.847264Z"},{"id":"DEBIAN-CVE-2022-31197","description":"PostgreSQL JDBC Driver (PgJDBC for short) allows Java programs to connect to a PostgreSQL database using standard, database independent Java code. The PGJDBC implementation of the `java.sql.ResultRow.refreshRow()` method is not performing escaping of column names so a malicious column name that contains a statement terminator, e.g. `;`, could lead to SQL injection. This could lead to executing additional SQL commands as the application's JDBC user. User applications that do not invoke the `ResultSet.refreshRow()` method are not impacted. User application that do invoke that method are impacted if the underlying database that they are querying via their JDBC application may be under the control of an attacker. The attack requires the attacker to trick the user into executing SQL against a table name who's column names would contain the malicious SQL and subsequently invoke the `refreshRow()` method on the ResultSet. Note that the application's JDBC user and the schema owner need not be the same. A JDBC application that executes as a privileged user querying database schemas owned by potentially malicious less-privileged users would be vulnerable. In that situation it may be possible for the malicious user to craft a schema that causes the application to execute commands as the privileged user. Patched versions will be released as `42.2.26` and `42.4.1`. Users are advised to upgrade. There are no known workarounds for this issue.","status":"published","published":"2022-08-03T19:15:08.63Z","modified":"2026-11-03T06:02:32.400887712Z","updated_at":"2026-11-03T06:44:05.456691Z"},{"id":"DLA-3140-1","title":"libpgjava - security update","status":"published","published":"2022-10-07T00:00:00Z","modified":"2026-03-09T01:22:22.949883Z","updated_at":"2026-11-02T15:46:11.189256Z"},{"id":"DLA-3995-1","title":"libpgjava - security update","status":"published","published":"2024-12-16T00:00:00Z","modified":"2026-03-09T01:21:29.724538Z","updated_at":"2026-11-02T15:46:12.203458Z"},{"id":"openSUSE-SU-2024:12369-1","title":"postgresql-jdbc-42.2.25-3.1 on GA media","description":"These are all security issues fixed in the postgresql-jdbc-42.2.25-3.1 package on the GA media of openSUSE Tumbleweed.","status":"published","published":"2024-06-15T00:00:00Z","modified":"2026-02-04T03:06:56.278497Z","updated_at":"2026-11-02T16:58:35.751245Z"},{"id":"SUSE-SU-2022:3537-1","title":"Security update for postgresql-jdbc","description":"This update for postgresql-jdbc fixes the following issues:\n\n- CVE-2022-31197: Fixed SQL injection vulnerability (bsc#1202170).\n","status":"published","published":"2022-10-06T08:55:52Z","modified":"2026-02-04T02:35:47.650349Z","updated_at":"2026-11-02T15:53:51.440565Z"},{"id":"SUSE-SU-2022:3541-1","title":"Security update for postgresql-jdbc","description":"This update for postgresql-jdbc fixes the following issues:\n\n- CVE-2022-31197: Fixed SQL injection vulnerability (bsc#1202170).\n","status":"published","published":"2022-10-06T10:00:04Z","modified":"2026-02-04T03:25:48.617774Z","updated_at":"2026-11-02T15:53:51.440565Z"},{"id":"SUSE-SU-2022:3613-1","title":"Security update for postgresql-jdbc","description":"This update for postgresql-jdbc fixes the following issues:\n\n- CVE-2022-31197: Fixed SQL injection vulnerability (bsc#1202170).\n","status":"published","published":"2022-10-18T11:05:06Z","modified":"2026-02-04T04:30:48.605272Z","updated_at":"2026-11-02T15:53:51.440565Z"},{"id":"SUSE-SU-2022:3705-1","title":"Security update for postgresql-jdbc","description":"This update for postgresql-jdbc fixes the following issues:\n\n- CVE-2022-31197: Fixed SQL injection vulnerability (bsc#1202170).\n","status":"published","published":"2022-10-24T13:14:52Z","modified":"2026-02-04T03:03:15.527756Z","updated_at":"2026-11-02T15:53:51.440565Z"}]}}
