Summary
The PostgreSQL ODBC driver psqlODBC up to and including 18.00.0006 contains multiple memory-management bugs (CWE-416, CWE-415, CWE-787). Affected areas include commit/rollback clean-up, the libpq notice callback, freeing statements with multiple cursors (FetchRefcursors=1 or UseDeclareFetch=1), updatable cursors after rollback with UseDeclareFetch=1, SQLGetData() after a failed multi-row fetch, SQLProcedureColumns() on a failed catalog query, the statement parser in a process named sqlservr (SQL Server linked servers) with a server version below 8.4, and a failed SQLPutData during SQLSetPos()/SQLBulkOperations().
Per the CVSS vector, the attack is network-based and requires no privileges, but has high complexity and requires user interaction (the application must connect or perform specific operations). Most cases can be triggered by a hostile or compromised server, or by anyone on the network path of a connection not using sslmode=verify-full (the default is disable). A database user who can make a statement fail or controls row contents can trigger the UseDeclareFetch=1 and SQLGetData() cases even against an honest server.
Demonstrated impact is crashes and heap corruption; code execution has not been demonstrated, though potential impact on confidentiality, integrity and availability is rated high. The vulnerability is not listed in CISA KEV.
Who is affected
Organizations and systems using the psqlODBC driver (up to 18.00.0006) to connect applications, including SQL Server linked servers, to PostgreSQL databases.
What to do
- Inventory all systems with psqlODBC installed and check the version (versions up to and including 18.00.0006 are affected).
- No fixed version is listed in the record; check the official advisory (GHSA-48v4-hjc5-hx8w) and the changelog at odbc.postgresql.org, and upgrade to a fixed release as soon as available.
- Configure ODBC connections with sslmode=verify-full to prevent on-path attackers from injecting server responses.
- Avoid UseDeclareFetch=1 and FetchRefcursors=1 where not required, and connect only to trusted PostgreSQL servers.
- Monitor crashes of applications using psqlODBC (e.g. sqlservr processes) as a possible indicator of exploitation.
Affected products and versions
CVSS vector, explained
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
- Attack vector
- Network (from the internet)
- Attack complexity
- High
- Privileges required
- None (no login)
- User interaction
- 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-48v4-hjc5-hx8w vendor advisory
- odbc.postgresql.org/changelog/
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.