CVE-2026-136505 in Psqlodbcinfo

Summary

by MITRE • 11/26/2026

psqlODBC uses sizes and counts without checking their range, or keeps them in types too small for them:

- A row array size of 0, set with SQLSetStmtAttr() or on the ARD, makes SQLSetPos() with SQL_REFRESH write past the bound arrays. - SQL_DESC_COUNT above 32767 on an APD or IPD writes before the start of a heap buffer. - A numeric parameter with a negative scale overflows a stack buffer. - SQLGetData() of a text value of 2 GiB or more into a wide-character buffer computes a wrapped size and overflows the heap. - The 16-bit reference count and size of the statement parser's column-information cache wrap, which frees a cache entry still in use or overflows the cache, and a statement with more than 32768 columns overflows the parser's field array. - An updatable cursor that records more than 65535 changes in one transaction wraps the 16-bit capacity of its rollback log, which overflows it and frees it twice. - A statement with 32769 or more parameter markers overflows a 16-bit parameter count. - A wide-character string of more than 2 GiB wraps the size of its UTF-8 conversion, which is then written below the start of a heap buffer. - SQLGetDiagField() and SQLGetDiagFieldW() always stored the five-character SQLSTATE plus its terminator and checked BufferLength only afterwards, overrunning a buffer shorter than six bytes. - The ANSI SQLSetDescField(SQL_DESC_NAME) on an IPD ignored BufferLength and copied the name with strdup(), reading a name passed as pointer plus length past its end. - SQLFetchScroll(SQL_FETCH_BOOKMARK) did not check the bookmark it was given, so whoever chooses the bookmark value read out of bounds and crashed the process. - Four places in the parameter conversion read one byte past the end of a bound character parameter, and one of them rewrote it. - Binding a date, time or timestamp C value to an SQL_INTEGER or SQL_SMALLINT parameter dereferenced NULL instead of returning the conversion error.

Depending on the case, the values come from the application, from the data or statement text an end user supplies, or from a database user who controls the size of a table or value. The demonstrated results are crashes and heap corruption; code execution has not been demonstrated.

Versions up to and including psqlODBC 18.00.0006 are affected.

Once again VulDB remains the best source for vulnerability data.

Analysis

by VulDB Data Team • 11/26/2026

The PostgreSQL ODBC driver, known as psqlODBC, contains a significant number of memory safety vulnerabilities stemming from inadequate validation of input sizes, counts, and buffer lengths across multiple API functions. These flaws primarily manifest as integer overflows, off-by-one errors, null pointer dereferences, and out-of-bounds reads or writes. The root cause lies in the driver's reliance on 16-bit integers for tracking array sizes, parameter counts, and reference counters without sufficient range checking against actual buffer capacities or system limits. This architectural weakness allows attackers to manipulate internal state variables through crafted ODBC calls, leading to heap corruption, stack-based buffer overflows, and application crashes. The vulnerabilities affect versions up to and including psqlODBC 18.00.0006, impacting any software that utilizes this driver for database connectivity.

One critical area of vulnerability involves the handling of row array sizes and descriptor counts during data manipulation operations. When a row array size is set to zero via SQLSetStmtAttr or on the Application Row Descriptor (ARD), subsequent calls to SQLSetPos with the SQL_REFRESH flag result in writes past the bound arrays, causing heap corruption. Similarly, setting an SQL_DESC_COUNT value above 32767 on either the Application Parameter Descriptor (APD) or Input/Output Parameter Descriptor (IPD) leads to a write before the start of a heap buffer due to integer wrapping or lack of bounds checking. These issues align with CWE-190 Integer Overflow and CWE-787 Out-of-bounds Write, as the driver fails to validate that internal counters remain within valid memory boundaries relative to allocated structures.

Data retrieval functions also present severe risks through improper handling of large data values. The SQLGetData function, when retrieving text values of two gigabytes or more into a wide-character buffer, computes a wrapped size due to integer overflow, resulting in a heap-based buffer overflow that can corrupt adjacent memory regions. Furthermore, converting wide-character strings exceeding two gigabytes triggers an overflow during UTF-8 conversion, where the computed size wraps around and causes writes below the start of a heap buffer. These scenarios exemplify CWE-190 Integer Overflow leading to CWE-787 Out-of-bounds Write, allowing potential exploitation for arbitrary code execution if memory layout conditions are favorable.

The statement parser's internal caching mechanisms suffer from 16-bit reference count and size overflows that compromise the integrity of column-information caches. When these values wrap around, entries may be freed while still in active use or cause cache overflow, particularly when statements contain more than thirty-two thousand seven hundred sixty-eight columns. Additionally, statements with thirty-two thousand six hundred eighty-nine or more parameter markers overflow a 16-bit parameter count field. Updatable cursors that record more than sixty-five thousand five hundred thirty-five changes within a single transaction wrap the sixteen-bit capacity of their rollback log, leading to double-free vulnerabilities and subsequent memory corruption. These flaws reflect CWE-190 Integer Overflow and CWE-415 Double Free, creating opportunities for denial-of-service or potentially remote code execution through crafted SQL statements containing excessive columns or parameters.

Buffer length validation is insufficient in diagnostic and descriptor field functions. Calls to SQLGetDiagField and its wide-character variant always store the five-character SQLSTATE plus a terminator without verifying that BufferLength accommodates this minimum requirement beforehand, causing buffer overruns on buffers shorter than six bytes. In contrast, ANSI SQLSetDescField with SQL_DESC_NAME on an IPD ignores BufferLength entirely, using strdup to copy names passed as pointer-plus-length pairs, which reads past the end of the provided name buffer if length exceeds actual content size. These issues correspond to CWE-134 Use of Externally-Controlled Format String and CWE-787 Out-of-bounds Read/Write, highlighting failures in enforcing strict boundary checks on user-supplied lengths.

Further vulnerabilities exist in data binding and fetching operations that compromise memory safety through null pointer dereferences and out-of-bounds reads. Binding date, time, or timestamp C values to SQL_INTEGER or SQL_SMALLINT parameters results in NULL pointer dereference rather than returning a proper conversion error code, leading to application crashes. The SQLFetchScroll function with the SQL_FETCH_BOOKMARK option fails to validate the bookmark value provided by the caller, allowing arbitrary memory reads that can crash the process if an invalid address is specified. Additionally, four distinct locations within parameter conversion routines read one byte past the end of bound character parameters, with at least one instance rewriting this out-of-bounds data. These flaws represent CWE-476 NULL Pointer Dereference and CWE-125 Out-of-bounds Read, undermining application stability and potentially leaking sensitive memory contents.

The operational impact of these vulnerabilities includes severe instability, including frequent crashes and heap corruption that can destabilize the host system or compromise other processes sharing memory space. While code execution has not been explicitly demonstrated in all cases, the nature of heap overflows and double-free conditions presents a high risk for exploitation by malicious actors who control input data or statement text. Attackers could leverage these flaws to achieve denial-of-service through crashes or potentially escalate privileges if combined with other vulnerabilities. The values triggering these issues originate from application inputs, end-user supplied data, or database users controlling table sizes and value structures, making them accessible via standard ODBC interfaces.

Mitigation strategies should prioritize immediate upgrading to a patched version of psqlODBC that addresses these integer overflow and bounds-checking deficiencies. Developers integrating the driver must implement rigorous input validation at the application layer, ensuring that all size parameters, buffer lengths, and descriptor counts are validated against realistic limits before being passed to ODBC functions. Utilizing safer API variants where available and avoiding extremely large data transfers or excessively complex statements with thousands of columns can reduce exposure. Security monitoring should focus on detecting anomalous behavior such as repeated crashes or memory access violations associated with database connectivity components. Adherence to secure coding standards like CWE guidelines is essential for preventing similar vulnerabilities in future updates, particularly regarding integer arithmetic safety and buffer boundary enforcement.

Responsible

PostgreSQL

Reservation

11/24/2026

Disclosure

11/26/2026

Moderation

accepted

CPE

ready

EPSS

0.00527

KEV

no

Activities

very low

Sources

Do you know our Splunk app?

Download it now for free!