CVE-2026-136515: Memory corruption and crashes when the driver rewrites statements for cursors and escapes
psqlODBC rewrites statement text for keyset-driven cursors and ODBC escapes using positions it found in the text. These positions could lie outside the text or describe another statement:
- After SQLExecDirect() failed on a statement handle, the FROM and WHERE positions of the failed statement were applied to the next, shorter statement on that handle. - The parser could record a FROM position with no text after it, and the rewrite then copied a negative length. - An {fn …} escape whose arguments contain FOR UPDATE, ; or INTO … FROM made the driver remove a cursor prefix from the wrong buffer. - {fn CONVERT(?, …)} with an output parameter produced a negative argument length. - An unclosed {fn …} escape made the driver read past the statement, and a few thousand nested ones exhausted the stack. - Translating @@identity in long statement text read an uninitialised pointer, and {? = call …} with nothing bound for the return value dereferenced NULL.
Whoever supplies the text of a statement that an application opens on a keyset-driven or dynamic cursor with a concurrency other than read-only, or calls with an output parameter, can corrupt the application's heap and end it. That includes the users of query tools, report builders and other applications that run SQL their users type. Code execution has not been demonstrated.
Versions up to and including psqlODBC 18.00.0006 are affected.
Affected Software
Event History
Frequently Asked Questions
Which applications are realistically exposed to this issue?
Applications using psqlODBC are exposed when untrusted parties can supply SQL statement text that is executed with a keyset-driven or dynamic cursor using a concurrency mode other than read-only, or when calls use output parameters. The affected paths also include ODBC escape processing and specific statement forms described in the advisory.
What access does an attacker need to trigger the issue?
An attacker needs the ability to control statement text supplied to the application, or to influence calls involving output parameters. No user interaction is required, but exploitation has high attack complexity and requires low privileges.
What can happen if the flaw is triggered?
The driver can corrupt the application's heap, cause the application to crash, read beyond statement text, exhaust the stack, dereference NULL, or use an uninitialised pointer. The reported impact includes high confidentiality, integrity, and availability consequences.
How can teams identify potentially affected usage before a fix is available?
Review applications using psqlODBC for SQLExecDirect() calls that reuse a statement handle after a failed execution, keyset-driven or dynamic cursors with non-read-only concurrency, ODBC {fn …} escapes, @@identity translation, and {? = call …} statements with an unbound return value. Also review calls with output parameters, particularly {fn CONVERT(?, …)}.