Summary
The psqlODBC driver parses statement text itself to substitute parameters, translate ODBC escapes, join batched statements and rewrite queries for updatable cursors. In several places it reads the text differently from the PostgreSQL server. Examples include lowercase e'…' escape strings, a } inside a literal within {d …}/{ts …} sequences, dollar-quote tags containing _, -- and /*/ comments, table names containing $, a NUL byte in an integer parameter, and ConnSettings being split at every semicolon. As a result, text the driver treats as data can run as SQL, and positioned writes can land in another table.
CVSS 8.1 (AV:N/AC:H/PR:N/UI:N): the attack is network-based, needs no authentication and no user interaction, but has high complexity. The affected application must place user-controlled text or parameters into statements. An end user can then run SQL with the rights of the application's database role. A database user who can create a table with a crafted name can redirect another user's positioned writes to a table of their choosing. Impact on confidentiality, integrity and availability is high.
Versions up to and including 18.00.0006 are affected. The vulnerability is not listed in CISA KEV, and no EPSS data is available.
Who is affected
Organizations whose applications access PostgreSQL through the psqlODBC driver version 18.00.0006 or earlier.
What to do
- Inventory systems and applications using psqlODBC and check the installed version (≤ 18.00.0006 is vulnerable).
- No fixed version is listed in the record. Check the official advisory (GHSA-4392-6j85-5q2q) and the changelog at odbc.postgresql.org, and upgrade to the fixed release once available.
- Do not place end-user values into ConnSettings or directly into SQL text. Use parameters and validate input.
- Restrict application database role privileges and table-creation rights, especially where updatable cursors and positioned writes are used.
- Review database logs for unexpected queries or changes to unexpected tables.
Affected products and versions
CVSS vector, explained
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- Network (from the internet)
- Attack complexity
- High
- Privileges required
- None (no login)
- User interaction
- Not required
- Scope
- Vulnerable component only
- Confidentiality
- High impact
- Integrity
- High impact
- Availability
- High impact
Weakness type (CWE)
- CWE-89 Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
- CWE-706 Use of Incorrectly-Resolved Name or Reference
References
- github.com/postgresql-interfaces/psqlodbc/security/advisories/GHSA-4392-6j85-5q2q vendor advisory
- odbc.postgresql.org/changelog/
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.