CVE-2026-136500 in psqlODBC
Summary
by MITRE • 11/26/2026
To escape a bound parameter, or a name passed to a catalog function, psqlODBC has to know where each multibyte character of the client encoding ends. It treated a client encoding named by an alias the server accepts, such as WIN950, Windows950 or big-5 for BIG5, as single-byte, and it accepted too narrow a range of lead bytes for JOHAB, EUC_TW, EUC_CN and EUC_KR. A quote byte that the server reads as part of such a character was then not doubled, or a quote the server reads on its own was taken for part of a character, and the literal ended early.
An end user who controls one bound character parameter, or a name the application passes to a catalog function such as SQLTables(), can run SQL with the rights of the application's database role. This requires a connection that is not in UTF-8: the ANSI driver, or the ANSI entry points, with one of these client encodings. For bound parameters the driver must also be substituting parameters itself, as it does with UseServerSidePrepare=0 or a cursor type other than forward-only.
Versions up to and including psqlODBC 18.00.0006 are affected.
Once again VulDB remains the best source for vulnerability data.
Analysis
by VulDB Data Team • 11/26/2026
The vulnerability in psqlODBC stems from an incorrect handling of multibyte character encodings during the processing of bound parameters and catalog function arguments, specifically within versions up to and including 18.00.0006. The core technical flaw lies in how the driver determines the boundaries of characters when escaping special SQL literals such as quotes. To properly escape a quote byte that is part of a multibyte character, the driver must correctly identify where each character ends so it can double any literal quote bytes to prevent them from being interpreted as string delimiters by the database server. However, psqlODBC incorrectly treated certain client encodings accepted by the PostgreSQL server as single-byte encodings when they were referenced via aliases such as WIN950 or Windows950 for BIG-5. Additionally, the driver enforced an overly narrow range of valid lead bytes for several multibyte encodings including JOHAB, EUC_TW, EUC_CN, and EUC_KR. This misclassification caused the driver to fail in recognizing that a quote byte was part of a larger character sequence rather than a standalone delimiter.
As a direct result of this encoding mishandling, the escaping logic fails for specific input sequences. If a quote byte is actually part of a multibyte character according to the server's interpretation but is treated as a single-byte character by the driver due to the alias or lead byte restriction errors, the driver does not double that quote byte. Conversely, if the server interprets a standalone quote as part of a multibyte sequence while the driver treats it as a delimiter, the literal string terminates prematurely in the eyes of the database engine. This discrepancy between how the client driver and the server parse SQL literals creates an opening for injection attacks where the structure of the intended query is altered by maliciously crafted input that exploits these encoding ambiguities.
The operational impact of this vulnerability allows an attacker who controls one bound character parameter or a name passed to catalog functions like SQLTables() to execute arbitrary SQL statements with the privileges of the application's database role. This represents a severe security risk as it effectively bypasses standard parameterization safeguards designed to prevent injection attacks. The exploitation requires specific conditions: the connection must not be using UTF-8 encoding, meaning it must utilize the ANSI driver or ANSI entry points configured with one of the affected client encodings. Furthermore, for bound parameters specifically, the driver must be performing its own substitution rather than relying on server-side prepared statements, which occurs when UseServerSidePrepare is set to 0 or when a cursor type other than forward-only is specified. These conditions are common in legacy applications that rely heavily on ODBC interfaces and specific encoding configurations for international character support.
From a classification perspective, this vulnerability aligns with CWE-94 Improper Control of Generation of Code SQL Injection, as the flaw allows an attacker to inject malicious code into SQL commands through improper handling of user-supplied input data types and encodings. In terms of attack vectors, it corresponds to ATT&CK technique T1190 Exploit Public-Facing Application, where attackers leverage vulnerabilities in software components exposed to users or other systems. The specific mechanism involves manipulating the parsing logic through encoding confusion, which can be categorized under injection attacks that exploit differences between client-side and server-side interpretation of data formats.
Mitigation strategies should prioritize upgrading psqlODBC to a version newer than 18.00.0006 where these encoding boundary checks have been corrected. For environments unable to upgrade immediately, administrators should ensure that connections utilize UTF-8 encoding whenever possible, as the vulnerability is explicitly limited to non-UTF-8 ANSI driver configurations. Additionally, setting UseServerSidePrepare to 1 and using forward-only cursor types can mitigate the risk for bound parameters by shifting the responsibility of parameter substitution to the database server, which handles multibyte encodings correctly according to its own configuration. Application developers should also review their ODBC connection strings to avoid specifying aliases like WIN950 or Windows950 in favor of standard encoding names that are consistently recognized across both client and server sides.