CVE-2024-33599: nscd: Stack-based buffer overflow in netgroup cache
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.
Other sources
glibc is vulnerable to a stack-based buffer overflow, caused by improper bounds checking when the Name Service Cache Daemon's (nscd) fixed size cache is exhausted by client requests. By sending a subsequent client request, a remote attacker could exploit this vulnerability to overflow a buffer and execute arbitrary code on the system.
— IBM
nscd: Stack-based buffer overflow in netgroup cache
If the Name Service Cache Daemon's (nscd) fixed size cache is exhausted by client requests then a subsequent client request for netgroup data may result in a stack-based buffer overflow. This flaw was introduced in glibc 2.15 when the cache was added to nscd.
This vulnerability is only present in the nscd binary.
— NVD
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-33599?
CVE-2024-33599 is classified as a high-severity vulnerability due to its stack-based buffer overflow nature.
How do I fix CVE-2024-33599?
To mitigate CVE-2024-33599, update to the latest versions of glibc as recommended in security advisories.
Which products are affected by CVE-2024-33599?
CVE-2024-33599 affects IBM QRadar Network Packet Capture version 7.5.0 - 7.5.0 Update Package 7 and certain versions of the glibc package.
What type of vulnerability is CVE-2024-33599?
CVE-2024-33599 is a stack-based buffer overflow vulnerability that may allow attackers to execute arbitrary code.
Are there any known exploits for CVE-2024-33599?
As of now, there are no public exploits available for CVE-2024-33599, but the vulnerability's high severity means potential risk exists.