Skip to content

CVE-2022-31197 SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc

HighCVSS 8.0 EPSS 2.4%
Published
Updated
Exploit status
No public exploit known
CISA SSVC
Proof of concept public · automatable: no · technical impact: total
Technology
UbuntuDebian

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.

Upgrade path

26 packages: 14 fixed, 9 with no fix yet.

PackageAffectedFixed inStatus
ubuntu/libpgjava(Ubuntu 14.04) = 9.2-1002-1; All versions No fix listed No fix yet
ubuntu/libpgjava(Ubuntu 16.04) = 9.2-1002-1; All versions No fix listed No fix yet
ubuntu/libpgjava(Ubuntu 22.04) = 42.2.23-1; = 42.2.24-1; = 42.3.1-1; = 42.3.2-1 +2 more No fix listed No fix yet
ubuntu/libpgjava(Ubuntu 24.04) = 42.5.4-1; = 42.6.0-2; = 42.7.0-1; = 42.7.1-1 +2 more No fix listed No fix yet
ubuntu/libpgjava(Ubuntu 25.10) = 42.7.5-1; = 42.7.5-2; = 42.7.7-1; All versions No fix listed No fix yet
ubuntu/libpgjava(Ubuntu 26.04) = 42.7.7-1; = 42.7.8-1; = 42.7.8-2; = 42.7.9-1 +2 more No fix listed No fix yet
ubuntu/libpgjava(Ubuntu 26.10) = 42.7.10-1; = 42.7.11-1; = 42.7.12-1; = 42.7.13-1 +1 more No fix listed No fix yet
ubuntu/libpgjava(Ubuntu Pro 18.04) = 9.4.1212-1; = 9.4.1212-1ubuntu0.1~esm1; All versions No fix listed No fix yet
ubuntu/libpgjava(Ubuntu Pro 20.04) = 42.2.6-1; = 42.2.8-1; = 42.2.9-1; = 42.2.10-1 +2 more No fix listed No fix yet
alpine/java-postgresql-jdbc(Alpine v3.16) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.17) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.18) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.19) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.20) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.21) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.22) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.23) < 42.4.2-r0 42.4.2-r0 Fixed
alpine/java-postgresql-jdbc(Alpine v3.24) < 42.4.2-r0 42.4.2-r0 Fixed
debian/libpgjava(Debian 12) < 42.4.1-1 42.4.1-1 Fixed
debian/libpgjava(Debian 13) < 42.4.1-1 42.4.1-1 Fixed
debian/libpgjava(Debian 14) < 42.4.1-1 42.4.1-1 Fixed
org.postgresql/postgresql(Maven) < 42.2.26; = 9.2-1002-jdbc4; = 9.2-1003-jdbc3; = 9.2-1003-jdbc4 +159 more 42.2.26, 42.3.7, 42.4.1 Fixed
postgresql jdbc driver < 42.2.26; = 42.4.0; = 42.4.0-rc1; = 42.4.1-rc1 +1 more 42.2.26, 42.3.7 Fixed
debian linux = 10.0 No fix listed Versions listed
fedoraproject fedora = 35; = 36 No fix listed Versions listed
pgjdbc = >= 42.2.0, < 42.2.26; = >= 42.3.0, < 42.4.1 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
org.postgresql/postgresql(Maven) < 42.2.26 42.2.26
org.postgresql/postgresql(Maven) = 42.0.0 No fix listed
org.postgresql/postgresql(Maven) = 42.0.0.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.0.0.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.1.0 No fix listed
org.postgresql/postgresql(Maven) = 42.1.0.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.1.1 No fix listed
org.postgresql/postgresql(Maven) = 42.1.1.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.1.1.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.1.2 No fix listed
org.postgresql/postgresql(Maven) = 42.1.2.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.1.2.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.1.3 No fix listed
org.postgresql/postgresql(Maven) = 42.1.3.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.1.3.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.1.4 No fix listed
org.postgresql/postgresql(Maven) = 42.1.4.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.1.4.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.0 No fix listed
org.postgresql/postgresql(Maven) = 42.2.0.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.0.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.1 No fix listed
org.postgresql/postgresql(Maven) = 42.2.1.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.1.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.10 No fix listed
Show 175 more
ProductAffected versionsFixed in
org.postgresql/postgresql(Maven) = 42.2.10.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.10.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.11 No fix listed
org.postgresql/postgresql(Maven) = 42.2.11.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.11.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.12 No fix listed
org.postgresql/postgresql(Maven) = 42.2.12.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.12.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.13 No fix listed
org.postgresql/postgresql(Maven) = 42.2.13.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.13.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.14 No fix listed
org.postgresql/postgresql(Maven) = 42.2.14.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.14.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.15 No fix listed
org.postgresql/postgresql(Maven) = 42.2.15.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.15.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.16 No fix listed
org.postgresql/postgresql(Maven) = 42.2.16.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.16.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.17 No fix listed
org.postgresql/postgresql(Maven) = 42.2.17.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.17.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.18 No fix listed
org.postgresql/postgresql(Maven) = 42.2.18.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.18.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.19 No fix listed
org.postgresql/postgresql(Maven) = 42.2.19.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.19.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.2 No fix listed
org.postgresql/postgresql(Maven) = 42.2.2.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.2.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.20 No fix listed
org.postgresql/postgresql(Maven) = 42.2.20.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.20.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.21 No fix listed
org.postgresql/postgresql(Maven) = 42.2.21.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.21.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.22 No fix listed
org.postgresql/postgresql(Maven) = 42.2.22.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.22.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.23 No fix listed
org.postgresql/postgresql(Maven) = 42.2.23.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.23.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.24 No fix listed
org.postgresql/postgresql(Maven) = 42.2.24.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.24.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.25 No fix listed
org.postgresql/postgresql(Maven) = 42.2.25.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.25.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.3 No fix listed
org.postgresql/postgresql(Maven) = 42.2.3.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.3.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.4 No fix listed
org.postgresql/postgresql(Maven) = 42.2.4.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.4.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.5 No fix listed
org.postgresql/postgresql(Maven) = 42.2.5.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.5.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.6.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.6.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.7.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.7.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.8 No fix listed
org.postgresql/postgresql(Maven) = 42.2.8.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.8.jre7 No fix listed
org.postgresql/postgresql(Maven) = 42.2.9 No fix listed
org.postgresql/postgresql(Maven) = 42.2.9.jre6 No fix listed
org.postgresql/postgresql(Maven) = 42.2.9.jre7 No fix listed
org.postgresql/postgresql(Maven) = 9.2-1002-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.2-1003-jdbc3 No fix listed
org.postgresql/postgresql(Maven) = 9.2-1003-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.2-1004-jdbc3 No fix listed
org.postgresql/postgresql(Maven) = 9.2-1004-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.2-1004-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1100-jdbc3 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1100-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1100-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1101-jdbc3 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1101-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1101-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1102-jdbc3 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1102-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1102-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1103-jdbc3 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1103-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1103-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1104-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.3-1104-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1200-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1200-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1201-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1201-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1202-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1202-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1202-jdbc42 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1203-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1203-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1203-jdbc42 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1204-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1204-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1204-jdbc42 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1205-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1205-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1205-jdbc42 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1206-jdbc4 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1206-jdbc41 No fix listed
org.postgresql/postgresql(Maven) = 9.4-1206-jdbc42 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1207 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1207.jre6 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1207.jre7 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1208 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1208.jre6 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1208.jre7 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1209 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1209.jre6 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1209.jre7 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1210 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1210.jre6 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1210.jre7 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1211 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1211.jre6 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1211.jre7 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1212 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1212.jre6 No fix listed
org.postgresql/postgresql(Maven) = 9.4.1212.jre7 No fix listed
org.postgresql/postgresql(Maven) >= 42.4.0, < 42.4.1 42.4.1
org.postgresql/postgresql(Maven) = 42.4.0 No fix listed
org.postgresql/postgresql(Maven) >= 42.3.0, < 42.3.7 42.3.7
org.postgresql/postgresql(Maven) = 42.3.0 No fix listed
org.postgresql/postgresql(Maven) = 42.3.1 No fix listed
org.postgresql/postgresql(Maven) = 42.3.2 No fix listed
org.postgresql/postgresql(Maven) = 42.3.3 No fix listed
org.postgresql/postgresql(Maven) = 42.3.4 No fix listed
org.postgresql/postgresql(Maven) = 42.3.5 No fix listed
org.postgresql/postgresql(Maven) = 42.3.6 No fix listed
pgjdbc = >= 42.2.0, < 42.2.26 No fix listed
pgjdbc = >= 42.3.0, < 42.4.1 No fix listed
ubuntu/libpgjava(Ubuntu:22.04) All versions No fix listed
postgresql jdbc driver < 42.2.26 42.2.26
postgresql jdbc driver >= 42.3.0, < 42.3.7 42.3.7
postgresql jdbc driver = 42.4.0 No fix listed
postgresql jdbc driver = 42.4.0-rc1 No fix listed
postgresql jdbc driver = 42.4.1-rc1 No fix listed
debian linux = 10.0 No fix listed
fedoraproject fedora = 35 No fix listed
fedoraproject fedora = 36 No fix listed
ubuntu/libpgjava(Ubuntu:24.04) All versions No fix listed
ubuntu/libpgjava(Ubuntu:26.04) All versions No fix listed
ubuntu/libpgjava(Ubuntu:26.10) All versions No fix listed
debian/libpgjava(Debian:12) < 42.4.1-1 42.4.1-1
debian/libpgjava(Debian:14) < 42.4.1-1 42.4.1-1
debian/libpgjava(Debian:13) < 42.4.1-1 42.4.1-1
ubuntu/libpgjava(Ubuntu:14.04) All versions No fix listed
ubuntu/libpgjava(Ubuntu:14.04) = 9.2-1002-1 No fix listed
ubuntu/libpgjava(Ubuntu:16.04) All versions No fix listed
ubuntu/libpgjava(Ubuntu:16.04) = 9.2-1002-1 No fix listed
ubuntu/libpgjava(Ubuntu:Pro:18.04) All versions No fix listed
ubuntu/libpgjava(Ubuntu:Pro:18.04) = 9.4.1212-1 No fix listed
ubuntu/libpgjava(Ubuntu:Pro:18.04) = 9.4.1212-1ubuntu0.1~esm1 No fix listed
ubuntu/libpgjava(Ubuntu:Pro:20.04) All versions No fix listed
ubuntu/libpgjava(Ubuntu:Pro:20.04) = 42.2.6-1 No fix listed
ubuntu/libpgjava(Ubuntu:Pro:20.04) = 42.2.8-1 No fix listed
ubuntu/libpgjava(Ubuntu:Pro:20.04) = 42.2.9-1 No fix listed
ubuntu/libpgjava(Ubuntu:Pro:20.04) = 42.2.10-1 No fix listed
ubuntu/libpgjava(Ubuntu:Pro:20.04) = 42.2.10-1ubuntu0.1~esm1 No fix listed
ubuntu/libpgjava(Ubuntu:22.04) = 42.2.23-1 No fix listed
ubuntu/libpgjava(Ubuntu:22.04) = 42.2.24-1 No fix listed
ubuntu/libpgjava(Ubuntu:22.04) = 42.3.1-1 No fix listed
ubuntu/libpgjava(Ubuntu:22.04) = 42.3.2-1 No fix listed
ubuntu/libpgjava(Ubuntu:22.04) = 42.3.3-1 No fix listed
ubuntu/libpgjava(Ubuntu:24.04) = 42.5.4-1 No fix listed
ubuntu/libpgjava(Ubuntu:24.04) = 42.6.0-2 No fix listed

References