CVE-2026-136502 in psqlODBCinfo

Summary

by MITRE • 11/26/2026

psqlODBC scans statement text itself to substitute parameters, translate ODBC escapes, join batched statements and rewrite queries for updatable cursors. Where it read the text differently from the server, text the driver took for data ran as SQL, or a positioned write went to another table:

- An escape string constant written e'…' in lower case was not recognised as one, and '…' after a keyword ending in E, as in LIKE'…', was taken for one. - A } inside a quoted literal ended an ODBC {d …}, {t …}, {ts …} or {escape …} sequence.
- Dollar-quote tags containing _ were not recognised, and an identifier starting with _ followed by $, such as _$$, was taken for the start of a dollar quote, so a parameter marker inside a literal was substituted. - A trailing -- comment in one statement of a batched parameter array swallowed the next statement. - Comments, literals longer than 255 bytes and escape strings were misread when the driver located the FROM and WHERE clauses of a query for an updatable cursor, and the text copied into the cursor's own queries could include SQL from inside a literal. - A table name containing $ was cut at the $, and a quoted table name starting with , or ; ended the table list, so positioned updates, inserts and deletes went to another table. - An integer parameter with an embedded NUL byte cut the query short. - /*/ was taken for a comment that opens and closes, while the server reads it as one that only opens. - ConnSettings was split at every semicolon, including one inside a quoted literal, so an application that puts an end user's value into a SET command there ran the rest of the value as SQL at connect time.

An end user who controls text the application puts into a statement, or a parameter value, can 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.

Versions up to and including psqlODBC 18.00.0006 are affected.

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 11/26/2026

The vulnerability in psqlODBC stems from fundamental flaws in the driver’s internal parsing logic, which is responsible for scanning statement text to substitute parameters, translate ODBC escape sequences, join batched statements, and rewrite queries for updatable cursors. The core issue arises when the driver’s parser interprets SQL syntax differently than the PostgreSQL server does. This divergence creates a critical security gap where data intended as literal values or comments is misinterpreted as executable SQL code by the driver before it reaches the database engine. Consequently, an attacker who controls input text within application statements or parameter values can exploit these parsing discrepancies to execute arbitrary SQL commands with the privileges of the application’s database role. This represents a severe injection vulnerability where the middleware itself becomes the vector for exploitation rather than just the final destination server.

One significant aspect of this flaw involves the misinterpretation of string literals and escape sequences. The driver fails to correctly recognize lowercase escape string constants denoted by e'…', leading it to treat subsequent text incorrectly. Furthermore, if a keyword ends with the letter E, such as in LIKE '…', the parser erroneously identifies the following quoted string as an escape sequence. This misclassification allows data that should remain inert to be processed as code. Additionally, dollar-quote tags containing underscores are not recognized by the driver, while identifiers starting with an underscore followed by a dollar sign, like _$$, are incorrectly parsed as the start of a dollar-quoted literal. If a parameter marker exists inside such a misidentified literal, it gets substituted prematurely or improperly, altering the query's intent and potentially exposing sensitive data or allowing unauthorized operations.

The parsing errors extend to comment handling and batch processing mechanisms. A trailing double-dash comment in one statement within a batched parameter array causes the driver to swallow the subsequent statement entirely, disrupting intended logic flow. More dangerously, comments are misread when locating FROM and WHERE clauses for updatable cursors; text copied into the cursor’s own queries may include SQL fragments that were originally inside literals or comments. The sequence /*/ is interpreted by the driver as a comment that opens and immediately closes, whereas PostgreSQL treats it as an opening-only comment. This discrepancy allows subsequent malicious code to be executed under the guise of being commented out from the server's perspective but active in the driver’s rewritten query. Similarly, integer parameters containing embedded NUL bytes cause the query string to be truncated prematurely, which can bypass security checks or alter execution paths unexpectedly.

Structural parsing errors also lead to severe data integrity and access control issues. Table names containing a dollar sign are cut off at that character, and quoted table names starting with commas or semicolons incorrectly terminate the table list. These flaws mean that positioned updates, inserts, and deletes intended for one specific table can be redirected to another table chosen by an attacker who has the ability to create tables with crafted names. This capability allows a database user to redirect writes from other users’ operations into their own controlled storage, facilitating data exfiltration or corruption. Furthermore, connection settings are split at every semicolon encountered in the configuration string, including those inside quoted literals. If an application places end-user input directly into a SET command within these settings, any subsequent content is executed as SQL code during the connection phase, providing immediate remote code execution capabilities upon authentication.

The operational impact of this vulnerability is profound, affecting versions up to and including psqlODBC 18.00.0006. It enables both external attackers controlling application input and internal database users with table creation privileges to compromise system integrity. From a classification perspective, these issues align closely with CWE-94 Improper Control of Generation of Code (Code Injection) due to the execution of unintended SQL commands derived from user-controlled data. The redirection of positioned writes also relates to CWE-610 Externally Controlled Reference to a Resource in Another Domain, as attackers can manipulate where database operations are directed. In terms of MITRE ATT&CK mapping, this vulnerability facilitates techniques associated with T1190 Exploit Public-Facing Application and potentially T1543 Create or Modify System Process if the executed SQL grants elevated privileges.

Mitigation strategies must prioritize immediate patching to a version where these parsing logic errors are resolved. Organizations relying on psqlODBC should verify their driver versions and upgrade promptly to eliminate the risk of SQL injection through middleware misinterpretation. In environments where upgrading is not immediately feasible, strict input validation and parameterization practices within applications using this driver can help reduce exposure, although they may not fully mitigate issues related to connection string manipulation or batched statement parsing flaws. Security teams should also audit database permissions to limit the ability of application accounts to create tables with arbitrary names, thereby reducing the risk of positioned write redirection attacks. Continuous monitoring for anomalous SQL execution patterns originating from ODBC connections can aid in detecting exploitation attempts while remediation efforts are underway.

Responsible

PostgreSQL

Reservation

11/24/2026

Disclosure

11/26/2026

Moderation

accepted

CPE

ready

EPSS

0.00501

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!