glibc is vulnerable to a denial of service, caused by a memory corruption by the Name Service Cache Daemon's (nscd) netgroup cache when the NSS callback fails to store all strings in the provided buffer. A local attacker could exploit this vulnerability to corrupt memory and cause a denial of service.
A stack-based buffer overflow in nscd was reported and assigned CVE-2024-33599.
Reference: https://sourceware.org/bugzilla/showbug.cgi?id=31677
---
nscd/netgroupcache.c (addinnetgrX):
497 struct indataset 498 { 499 struct datahead head; 500 innetgroupresponseheader resp; 501 } dataset 502 = (struct indataset ) mempoolalloc (db, 503 sizeof (dataset) + req->keylen, 504 1);
mempoolalloc fails and returns NULL.
This is possible if posixfallocate fails and the retry fails.
505 struct indataset datasetmem; 506 bool cacheable = true; 507 if (glibcunlikely (dataset == NULL)) 508 { 509 cacheable = false; 510 dataset = &datasetmem;
This structure has no room for req->keylen material.
511 } 512 513 dataheadinitpos (&dataset->head, sizeof (dataset) + req->keylen, 514 sizeof (innetgroupresponseheader), 515 he == NULL ? 0 : dh->nreloads + 1, result->head.ttl); 516 / Set the notfound status and timeout based on the result from 517 getnetgrent. / 518 dataset->head.notfound = result->head.notfound; 519 dataset->head.timeout = timeout; 520 521 dataset->resp.version = NSCDVERSION; 522 dataset->resp.found = result->resp.found; 523 / Until we find a matching entry the result is 0. / 524 dataset->resp.result = 0; 525 526 char keycopy = memcpy ((char ) (dataset + 1), group, req->keylen);
This copies up to req->keylen material to a structure that has no storage space for it.
This was detected by static code analysis.
It will only happen in the case the database runs out of memory/storage while expanding the netgroup cache.
The group entries overwrite other data on the stack after datasetmem.
The workaround is not to cache the netgroup if this is impacting the use of the application.
glibc is vulnerable to a denial of service, caused by a memory allocation failure when the Name Service Cache Daemon's (nscd) netgroup cache uses the xmalloc or xrealloc functions. A local attacker could exploit this vulnerability to terminate the daemon.
An integer overflow, leading to buffer overflow flaw was found in the way the implementation of strcoll() routine, used to compare two strings based on the current locale, of glibc, the GNU libc libraries, performed calculation of memory requirements / allocation, needed for storage of the strings. If an application linked against glibc was missing an application-level sanity checks for validity of strcoll() arguments and accepted untrusted input, an attacker could use this flaw to cause the particular application to crash or, potentially, execute arbitrary code with the privileges of the user running the application.
Upstream bug report (including reproducer): [1] http://sourceware.org/bugzilla/showbug.cgi?id=14547
After a failed cache insertion, addgetnetgrentX tries to send the non-existing response after the not-found header.
In addinnetgrX, addgetnetgrentX may have produced a NULL result, indicating a not-found status, but this is not handled in the subsequent code that prepares the record that will be sent out to the client.
Reference: https://sourceware.org/bugzilla/showbug.cgi?id=31678
A security flaw was found in the way strcoll() interface of glibc, the GNU libc libraries, performed failsafe back to alloca() routine when malloc() function call failed previously (due to out of memory [OOM] condition for example). If an application linked against glibc was missing an application-level sanity checks for validity of strcoll() arguments and accepted untrusted input, an attacker could use this flaw to cause the particular application to crash or, potentially, execute arbitrary code with the privileges of the user running the application.
Upstream bug report (including the reproducer): [1] http://sourceware.org/bugzilla/showbug.cgi?id=14552#c0
Issue / part: 1) alloca() stack overflow from [1].
References: [2] http://www.openwall.com/lists/oss-security/2012/09/07/9 [3] http://www.openwall.com/lists/oss-security/2012/09/07/15 [4] http://www.openwall.com/lists/oss-security/2012/09/10/1 [5] http://www.openwall.com/lists/oss-security/2012/09/10/3 [6] http://www.openwall.com/lists/oss-security/2012/09/13/16