CVE-2021-47218 selinux: fix NULL-pointer dereference when hashtab allocation fails
A NULL pointer dereference in the Linux kernel SELinux module can cause a denial of service when hash table allocation fails.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-47218?
CVE-2021-47218 is a medium-severity vulnerability in Linux kernel, published on 10 Apr 2024. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
In the Linux kernel, the following vulnerability has been resolved:
selinux: fix NULL-pointer dereference when hashtab allocation fails
When the hash table slot array allocation fails in hashtab_init(), h->size is left initialized with a non-zero value, but the h->htable pointer is NULL. This may then cause a NULL pointer dereference, since the policydb code relies on the assumption that even after a failed hashtab_init(), hashtab_map() and hashtab_destroy() can be safely called on it. Yet, these detect an empty hashtab only by looking at the size.
Fix this by making sure that hashtab_init() always leaves behind a valid empty hashtab when the allocation fails.
Weakness: CWE-476
Which versions are affected by CVE-2021-47218?
It affects 1 product.
Products include Linux kernel.
How do I fix CVE-2021-47218?
Apply the vendor's patch.
Is CVE-2021-47218 being exploited?
There is no known exploitation of CVE-2021-47218 in the wild and no public exploit code.
Other vulnerabilities in Linux kernel
Sources
Also known as DEBIAN-CVE-2021-47218, GHSA-h6wr-63v9-2m6h, UBUNTU-CVE-2021-47218.