{"answers":{"affected":"7 open source packages ship an affected version, including org.postgresql:postgresql and postgresql-jdbc-driver. It affects 3 products.","exploited":"It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-31197 exists.","fix":"Upgrade org.postgresql:postgresql to a fixed version for your release line: 42.2.26, 42.3.7 or 42.4.1.","what":"CVE-2022-31197 is a high-severity SQL injection vulnerability in Debian Debian Linux, published on 3 Aug 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2022-31197 and fix it if it is affected.\n\nWhat it is: CVE-2022-31197 is a high-severity SQL injection vulnerability in Debian Debian Linux, published on 3 Aug 2022. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.\nExploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-31197 exists.\n\nAffected packages and fixed versions:\n- org.postgresql:postgresql (Maven): affected all versions; fixed in 42.2.26\n- org.postgresql:postgresql (Maven): affected all versions; fixed in 42.2.26\n- org.postgresql:postgresql (Maven): affected from 42.3.0; fixed in 42.3.7\n- org.postgresql:postgresql (Maven): affected from 42.3.0; fixed in 42.3.7\n- org.postgresql:postgresql (Maven): affected from 42.4.0; fixed in 42.4.1\n- org.postgresql:postgresql (Maven): affected from 42.4.0; fixed in 42.4.1\n- postgresql-jdbc-driver (Bitnami): affected all versions up to 42.4.0; fixed in 42.2.26, 42.3.7\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2022-31197/ (Markdown: https://insights.sbomify.com/CVE-2022-31197/index.md)","id":"CVE-2022-31197","markdown":"https://insights.sbomify.com/CVE-2022-31197/index.md","name":"CVE-2022-31197","record":{"aliases":["ALSA-2023:0318","BIT-postgresql-jdbc-driver-2022-31197","CLEANSTART-2026-IG03910","DEBIAN-CVE-2022-31197","DLA-3140-1","GHSA-r38f-c4h4-hqq2","MINI-4gwc-6v9c-x7ww","MINI-6m3g-q98g-2jg9","MINI-73xw-vm44-4rjx","OESA-2022-1835","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"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["code_execution","privilege_escalation"],"network_reachable":"yes","non_default_config":false,"product_category":"PostgreSQL JDBC Driver","requires_auth":"low_privilege","summary":"SQL injection in pgjdbc allows attackers to execute arbitrary SQL commands via malicious column names when refreshRow is invoked.","user_interaction":"required","vuln_class":"sql_injection"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"debian_linux","vendor":"debian"},{"product":"fedora","vendor":"fedoraproject"},{"product":"postgresql_jdbc_driver","vendor":"postgresql"}],"cvss":{"score":7.1,"severity":"high","source":"cna","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H","version":"3.1"},"cwes":[{"id":"CWE-89","name":"Improper Neutralization of Special Elements used in an SQL Command"}],"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.","ecosystems":["AlmaLinux:9","Bitnami","Maven","Red Hat:enterprise_linux:9::appstream","Rocky Linux:9","SUSE:Linux Enterprise Module for Server Applications 15 SP3","SUSE:Linux Enterprise Module for Server Applications 15 SP4","SUSE:Linux Enterprise Server 12 SP2-BCL","SUSE:Linux Enterprise Server 12 SP3-BCL","SUSE:Linux Enterprise Server 12 SP4-LTSS","SUSE:Linux Enterprise Server 12 SP5","SUSE:Linux Enterprise Server for SAP Applications 12 SP4","SUSE:Linux Enterprise Server for SAP Applications 12 SP5","SUSE:Manager Server Module 4.1","SUSE:Manager Server Module 4.2","SUSE:OpenStack Cloud 9","SUSE:OpenStack Cloud Crowbar 9","openSUSE:Leap 15.3","openSUSE:Leap 15.4"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"weaponised"},"has_fix":true,"headline":"SQL Injection in ResultSet.refreshRow() with malicious column names in pgjdbc","id":"CVE-2022-31197","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"Bitnami","product":"debian:debian_linux","products":["debian:debian_linux","fedoraproject:fedora"],"type":"sql_injection","year":"2022"},"n_packages":24,"n_references":5,"next":{"headline":"GovernorVotesQuorumFraction updates to quorum may affect past defeated proposals in @openzeppelin/contracts","id":"CVE-2022-31198"},"packages":[{"ecosystem":"Bitnami","fixed":["42.2.26","42.3.7"],"introduced":["0","42.3.0","42.4.0"],"last_affected":["42.4.0"],"package":"postgresql-jdbc-driver","purl":"pkg:bitnami/postgresql-jdbc-driver","source":"BIT-postgresql-jdbc-driver-2022-31197"},{"ecosystem":"Maven","fixed":["42.2.26"],"introduced":["0"],"last_affected":[],"package":"org.postgresql:postgresql","purl":null,"source":"GHSA-r38f-c4h4-hqq2"},{"ecosystem":"Maven","fixed":["42.2.26"],"introduced":["0"],"last_affected":[],"package":"org.postgresql:postgresql","purl":"pkg:maven/org.postgresql/postgresql","source":"GHSA-r38f-c4h4-hqq2"},{"ecosystem":"Maven","fixed":["42.3.7"],"introduced":["42.3.0"],"last_affected":[],"package":"org.postgresql:postgresql","purl":null,"source":"GHSA-r38f-c4h4-hqq2"},{"ecosystem":"Maven","fixed":["42.3.7"],"introduced":["42.3.0"],"last_affected":[],"package":"org.postgresql:postgresql","purl":"pkg:maven/org.postgresql/postgresql","source":"GHSA-r38f-c4h4-hqq2"},{"ecosystem":"Maven","fixed":["42.4.1"],"introduced":["42.4.0"],"last_affected":[],"package":"org.postgresql:postgresql","purl":null,"source":"GHSA-r38f-c4h4-hqq2"},{"ecosystem":"Maven","fixed":["42.4.1"],"introduced":["42.4.0"],"last_affected":[],"package":"org.postgresql:postgresql","purl":"pkg:maven/org.postgresql/postgresql","source":"GHSA-r38f-c4h4-hqq2"},{"ecosystem":"AlmaLinux:9","fixed":["42.2.18-6.el9_1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/almalinux/postgresql-jdbc","source":"ALSA-2023:0318"},{"ecosystem":"Red Hat:enterprise_linux:9::appstream","fixed":["0:42.2.18-6.el9_1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/redhat/postgresql-jdbc","source":"RHSA-2023:0318"},{"ecosystem":"Rocky Linux:9","fixed":["0:42.2.18-6.el9_1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/rocky-linux/postgresql-jdbc?distro=rocky-linux-9-x86-64\u0026epoch=0","source":"RLSA-2023:0318"},{"ecosystem":"SUSE:Linux Enterprise Module for Server Applications 15 SP3","fixed":["42.2.25-150300.3.8.1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Module%20for%20Server%20Applications%2015%20SP3","source":"SUSE-SU-2022:3613-1"},{"ecosystem":"SUSE:Linux Enterprise Module for Server Applications 15 SP4","fixed":["42.2.25-150400.3.6.1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Module%20for%20Server%20Applications%2015%20SP4","source":"SUSE-SU-2022:3537-1"},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP2-BCL","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP2-BCL","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP3-BCL","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP3-BCL","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP4-LTSS","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP4-LTSS","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"SUSE:Linux Enterprise Server 12 SP5","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Server%2012%20SP5","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 12 SP4","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP4","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"SUSE:Linux Enterprise Server for SAP Applications 12 SP5","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2012%20SP5","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"SUSE:Manager Server Module 4.1","fixed":["42.2.10-150200.3.11.1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Manager%20Server%20Module%204.1","source":"SUSE-SU-2022:3705-1"},{"ecosystem":"SUSE:Manager Server Module 4.2","fixed":["42.2.25-150300.3.8.1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20Manager%20Server%20Module%204.2","source":"SUSE-SU-2022:3613-1"},{"ecosystem":"SUSE:OpenStack Cloud 9","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20OpenStack%20Cloud%209","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"SUSE:OpenStack Cloud Crowbar 9","fixed":["9.4-3.6.3"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/suse/postgresql-jdbc\u0026distro=SUSE%20OpenStack%20Cloud%20Crowbar%209","source":"SUSE-SU-2022:3541-1"},{"ecosystem":"openSUSE:Leap 15.3","fixed":["42.2.25-150300.3.8.1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/opensuse/postgresql-jdbc\u0026distro=openSUSE%20Leap%2015.3","source":"SUSE-SU-2022:3613-1"},{"ecosystem":"openSUSE:Leap 15.4","fixed":["42.2.25-150400.3.6.1"],"introduced":["0"],"last_affected":[],"package":"postgresql-jdbc","purl":"pkg:rpm/opensuse/postgresql-jdbc\u0026distro=openSUSE%20Leap%2015.4","source":"SUSE-SU-2022:3537-1"}],"prev":{"headline":"Server-Side Request Forgery (SSRF) vulnerability in Databasir","id":"CVE-2022-31196"},"products":["pgjdbc"],"published":"2022-08-03","related":[{"cvss_score":10,"headline":"ProFTPD Improper Access Control","id":"CVE-2015-3306","kev_date_added":"2026-10-08","published":"2015-05-18"},{"cvss_score":9.9,"headline":"RoundCube Webmail Deserialization of Untrusted Data","id":"CVE-2025-49113","kev_date_added":"2026-02-20","published":"2025-06-02"},{"cvss_score":9.8,"headline":"GNU InetUtils Argument Injection","id":"CVE-2026-24061","kev_date_added":"2026-01-26","published":"2026-01-21"},{"cvss_score":9.8,"headline":"Linux Kernel Improper Check for Unusual or Exceptional Conditions","id":"CVE-2025-39682","kev_date_added":"2026-09-18","published":"2025-09-05"},{"cvss_score":9.8,"headline":"Mozilla Firefox Use-After-Free","id":"CVE-2024-9680","kev_date_added":"2024-10-15","published":"2024-10-09"},{"cvss_score":9.8,"headline":"RARLAB UnRAR Directory Traversal","id":"CVE-2022-30333","kev_date_added":"2022-08-09","published":"2022-05-09"},{"cvss_score":9.8,"headline":"Roundcube Webmail SQL Injection","id":"CVE-2021-44026","kev_date_added":"2023-06-22","published":"2021-11-19"}],"sources":[{"class":"attribution","licence":"MIT","name":"AlmaLinux","prefix":"ALSA"},{"class":"attribution","licence":"Apache-2.0","name":"Bitnami","prefix":"BIT"},{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"CC BY 4.0","name":"Red Hat","prefix":"RHSA"},{"class":"attribution","licence":"BSD","name":"Rocky Linux","prefix":"RLSA"},{"class":"attribution","licence":"CC BY 4.0","name":"SUSE","prefix":"SUSE"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"poc","technical_impact":"total"},"state":"PUBLISHED","updated":"2025-11-03","vendors":["pgjdbc"]},"summary":"SQL injection in pgjdbc allows attackers to execute arbitrary SQL commands via malicious column names when refreshRow is invoked.","url":"https://insights.sbomify.com/CVE-2022-31197/"}