Summary
To escape bound parameters and names passed to catalog functions, psqlODBC must know where each multibyte character of the client encoding ends. The driver treated encodings named by a server-accepted alias (e.g. WIN950, Windows950 or big-5 for BIG5) as single-byte, and accepted too narrow a lead-byte range for JOHAB, EUC_TW, EUC_CN and EUC_KR. As a result, a quote byte the server reads as part of a character was not doubled, or a standalone quote was taken as part of a character, ending the literal early.
The attack is network-based, requires no authentication and no user interaction, but has high complexity (CVSS 8.1): the end user must control one bound character parameter or a name the application passes to a catalog function such as SQLTables(). The connection must not be UTF-8 (ANSI driver or ANSI entry points with one of these encodings), and for bound parameters the driver must substitute parameters itself (UseServerSidePrepare=0 or a non-forward-only cursor type).
A successful attacker can run SQL with the rights of the application's database role, with high impact on confidentiality, integrity and availability. The vulnerability is not listed in the CISA KEV catalog.
Who is affected
Organizations whose applications use psqlODBC 18.00.0006 or earlier with non-UTF-8 connections in BIG5 (and aliases), JOHAB, EUC_TW, EUC_CN or EUC_KR encodings.
What to do
- No fixed version is listed in the record; check the official advisory (GHSA-2rjm-67gc-54r4 and the changelog at odbc.postgresql.org) and upgrade psqlODBC to a release later than 18.00.0006 containing the fix.
- Inventory applications using psqlODBC and determine whether they use the ANSI driver or ANSI entry points with BIG5/WIN950/Windows950/big-5, JOHAB, EUC_TW, EUC_CN or EUC_KR client encoding.
- Where possible, switch to UTF-8 connections (Unicode driver), as UTF-8 connections are not affected per the description.
- Review UseServerSidePrepare and cursor type settings, since driver-side parameter substitution (UseServerSidePrepare=0 or non-forward-only cursors) enables the bound-parameter attack path.
- Restrict the application's database role to least privilege to limit the impact of a possible injection.
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-173 Improper Handling of Alternate Encoding
References
- github.com/postgresql-interfaces/psqlodbc/security/advisories/GHSA-2rjm-67gc-54r4 vendor advisory
- odbc.postgresql.org/changelog/
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.