Summary
psqlODBC (the PostgreSQL ODBC driver) uses sizes and counts in many functions without range checks or stores them in types that are too small (e.g. 16-bit). This causes integer overflows and out-of-bounds writes on the stack and heap. Examples include a row array size of 0 with SQLSetPos(SQL_REFRESH), SQL_DESC_COUNT above 32767, a numeric parameter with negative scale, text values of 2 GiB or more, statements with more than 32768 columns or parameters, more than 65535 changes in one transaction on an updatable cursor, an unchecked bookmark in SQLFetchScroll, and a NULL dereference when converting date/time values.
Per the CVSS vector, the attack is network-based, requires low privileges (e.g. a database user controlling table or value size, or an end user supplying data or statement text), needs no user interaction, but has high attack complexity. Potential impact on confidentiality, integrity and availability is high.
Demonstrated results are process crashes and heap corruption; code execution has not been demonstrated. The vulnerability is not listed in the CISA KEV catalog.
Who is affected
Organizations whose applications access PostgreSQL databases through the psqlODBC driver version 18.00.0006 or earlier.
What to do
- Inventory all systems and applications using psqlODBC and check the installed version (versions up to and including 18.00.0006 are affected).
- No fixed version is listed in the record; check the vendor's official advisory (GHSA-4g4f-phc4-3qh7 on GitHub and https://odbc.postgresql.org/changelog/) and install the new release as soon as it is available.
- Until upgraded, restrict who can submit arbitrary SQL statement text or very large values through psqlODBC-based applications, and limit database users' ability to create very large tables and values.
- Monitor for unexpected crashes of ODBC-based application processes as a possible indicator of exploitation attempts.
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)
- CWE-190 Integer Overflow or Wraparound
- CWE-787 Out-of-bounds Write
- CWE-121 Stack-based Buffer Overflow
References
- github.com/postgresql-interfaces/psqlodbc/security/advisories/GHSA-4g4f-phc4-3qh7 vendor advisory
- odbc.postgresql.org/changelog/
Sources: CVE.org (CNA and CISA ADP), CISA KEV, FIRST EPSS. Always check the vendor's official advisory.