CVE-2021-47218: selinux: fix NULL-pointer dereference when hashtab allocation fails
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.
Security readout for executives and security teams
Plain-English summary
This is a Linux kernel SELinux stability flaw. If a hash table allocation fails during policy handling, later cleanup or iteration code may dereference a NULL pointer. The sources do not provide CVSS, active exploitation, or a named workaround, so urgency is environment-dependent rather than an internet-wide emergency.
Executive priority
Handle through normal kernel patch management unless vendor guidance raises severity for your distribution. Prioritize sensitive or highly available Linux systems using SELinux. There is no source-backed evidence of active exploitation, but kernel crashes can still create operational risk.
Technical view
hashtab_init() could leave h->size nonzero while h->htable was NULL after slot-array allocation failure. policydb code treated failed initialization as a safely empty hashtab, and hashtab_map() or hashtab_destroy() could rely on size alone. The kernel fix ensures allocation failure leaves a valid empty hashtab state.
Likely exposure
Exposure is limited to Linux systems running affected kernel versions identified by the CVE record. SELinux-related policy database handling is the relevant component. The source bundle does not prove remote reachability, default exploitability, or distribution-specific package status.
Exploitation context
The source bundle lists no KEV entry and provides no evidence of active exploitation. The described impact is a NULL pointer dereference after memory allocation failure. Practical exploitation depends on whether an attacker can influence the affected SELinux policydb path and failure condition, which is not established in the sources.
Researcher notes
The evidence supports a reliability flaw in SELinux hashtab error handling, not a proven privilege escalation or remote exploit. Missing data includes CVSS, CWE, trigger prerequisites, attacker control, and distribution package mapping. Avoid overstating impact without vendor analysis or reproducible local validation.
Mitigation direction
Check Linux vendor advisories for patched kernel packages or backports.
Update affected kernels to versions containing the referenced stable fixes.
Prioritize systems where SELinux is enabled and operationally important.
Track distribution package notes; upstream commit presence may not equal package status.
If patching is delayed, monitor vendor guidance for supported mitigations.
Validation and detection
Inventory Linux kernel versions across servers, appliances, containers, and images.
Confirm whether SELinux is enabled on potentially affected systems.
Map installed kernels to vendor advisories or the referenced stable commits.
Review kernel crash records for SELinux policydb NULL dereference symptoms.
Document distribution-specific backport evidence before marking fixed.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2021-47218 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
0CVSS vectors
3Timeline events
2ADP providers
4Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: noTechnical Impact: total
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Apr 10, 2024, 19:01 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.