Summary
The PostgreSQL ODBC driver psqlODBC, up to and including version 18.00.0006, writes past the application's buffers in several cases (CWE-787). With SQL_C_DEFAULT, the C type of a bound column or parameter follows its SQL type. If the column's type at fetch time differs from the type the application saw when it described the statement, the driver writes the larger type into the smaller buffer. This happens when the server reports another type, when the table was altered, or when an output parameter's result column has another type. For example, it writes 12 bytes past a 4-byte buffer for a uuid, and more in multi-row fetches. Additional cases include Int8As set to a smaller type, int2vector columns, output parameters bound to a NULL buffer (a stack overflow inside the driver), and SQLGetData() with BufferLength 0 on a large object. A specific SQLBulkOperations(SQL_ADD) sequence on a static updatable cursor also frees a pointer that was never allocated and corrupts the heap.
The CVSS 3.1 score is 7.5 (High). The attack works over the network and needs no authentication, but it has high complexity and requires some action on the application or user side. It can be triggered by a hostile or compromised server. It can also be triggered by anyone on the network path of a connection that does not use sslmode=verify-full (the default is disable), or by the owner of a table the application reads.
Successful exploitation can affect the confidentiality, integrity and availability of the client application process. Possible outcomes are memory corruption, crashes and potentially code execution. The vulnerability is not listed in CISA KEV.
Who is affected
Organizations whose applications connect to PostgreSQL through the psqlODBC driver, version 18.00.0006 or earlier.
What to do
- No fixed version is listed in the record. Check the official advisory (GHSA-c66p-8p63-p7mr and https://odbc.postgresql.org/changelog/) and upgrade psqlODBC to a version that fixes the issue.
- Inventory the systems and applications that use psqlODBC and verify the installed version.
- Use sslmode=verify-full for PostgreSQL connections to block on-path attackers, because the default is disable.
- Connect only to trusted servers and review who owns or can alter the tables your applications read.
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)
- CWE-787 Out-of-bounds Write
References
- github.com/postgresql-interfaces/psqlodbc/security/advisories/GHSA-c66p-8p63-p7mr vendor advisory
- odbc.postgresql.org/changelog/
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.