Summary
The PostgreSQL ODBC driver psqlODBC rewrites SQL statement text for keyset-driven cursors and ODBC escapes using positions found in the text. Those positions could lie outside the text or belong to another statement. This leads to out-of-bounds writes and reads, dereferences of uninitialised or NULL pointers, and stack exhaustion through uncontrolled recursion. Example triggers include a failed SQLExecDirect() followed by a shorter statement, malformed or deeply nested {fn …} escapes, {fn CONVERT(?, …)} with an output parameter, and {? = call …} with no bound return value.
CVSS 7.5 (AV:N/AC:H/PR:L/UI:N): the attack is possible over the network, requires low privileges and no user interaction, but attack complexity is high. Exploitation only applies when an application opens the statement on a keyset-driven or dynamic cursor with non-read-only concurrency, or calls it with an output parameter. Anyone who can supply the text of such a statement can corrupt the application's heap and crash it. This includes users of query tools, report builders and other applications that run user-typed SQL.
Code execution has not been demonstrated. The vulnerability is not in the CISA KEV catalog, and no EPSS data is available.
Who is affected
Organisations whose applications, especially query tools and report builders, use psqlODBC 18.00.0006 or earlier to access PostgreSQL databases.
What to do
- Inventory systems with psqlODBC installed and check the version; all versions up to and including 18.00.0006 are affected.
- No fixed version is listed in the record; check the official advisory (GHSA-pw7w-x92p-r3q2) and the changelog at odbc.postgresql.org, and install the fixed release as soon as it is available.
- Until you upgrade, restrict who can enter arbitrary SQL into applications that use psqlODBC.
- Where possible, use read-only or forward-only cursors instead of updatable keyset-driven or dynamic cursors.
Affected products and versions
CVSS vector, explained
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack vector
- Network (from the internet)
- Attack complexity
- High
- Privileges required
- Regular user
- User interaction
- Not required
- Scope
- Vulnerable component only
- Confidentiality
- High impact
- Integrity
- High impact
- Availability
- High impact
Weakness type (CWE)
References
- github.com/postgresql-interfaces/psqlodbc/security/advisories/GHSA-pw7w-x92p-r3q2 vendor advisory
- odbc.postgresql.org/changelog/
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.