CVE-2021-3543: Use After Free
A failing usercopy of the slot uid will lead to a stale entry in the file descriptor table as putunusedfd() won't release it. This enables userland to refer to a dangling 'file' object through that still valid file descriptor, leading to all kinds of use-after-free exploitation scenarios.
Exchanging putunusedfd() for closefd(), ksysclose() or alike won't solve the underlying issue, as the file descriptor might have been replaced in the meantime, e.g. via userland calling close() on it (leading to a NULL pointer dereference in the error handling code as 'fget(enclavefd)' will return a NULL pointer) or by dup2()'ing a completely different file object to that very file descriptor, leading to the same situation: a dangling file descriptor pointing to a freed object -- just in this case to a file object of user's choosing.
Generally speaking, after the call to fdinstall() the file descriptor is live and userland is free to do whatever with it. We cannot rely on it to still refer to our enclave object afterwards. In fact, by abusing userfaultfd() userland can hit the condition without any racing and abuse the error handling in the nitro code as it pleases.
Other sources
A flaw null pointer dereference in the Nitro Enclaves kernel driver was found in the way that Enclaves VMs forces closures on the enclave file descriptor. A local user of a host machine could use this flaw to crash the system or escalate their privileges on the system.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
redhat/kernel-rtto a version that resolves this vulnerability.Fixed in 0:4.18.0-305.3.1.rt7.75.el8_4 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 0:4.18.0-305.3.1.el8_4 - Upgrade
Upgrade
redhat/kernelto a version that resolves this vulnerability.Fixed in 4.18.0 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 5.10.223-1Fixed in 5.10.234-1Fixed in 6.1.129-1Fixed in 6.1.135-1Fixed in 6.12.25-1Fixed in 6.12.27-1
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is the severity of CVE-2021-3543?
CVE-2021-3543 is considered to have a high severity due to its potential for use-after-free exploitation scenarios.
How do I fix CVE-2021-3543?
To fix CVE-2021-3543, users should update to kernel versions 0:4.18.0-305.3.1.rt7.75.el8_4, 0:4.18.0-305.3.1.el8_4, or appropriate patched versions from Red Hat or Debian.
Which software is affected by CVE-2021-3543?
CVE-2021-3543 affects multiple versions of the kernel, specifically those prior to certain patched releases from Red Hat and Debian.
What type of vulnerability is CVE-2021-3543?
CVE-2021-3543 is a use-after-free vulnerability that can lead to exploitation via dangling file descriptors.
Can CVE-2021-3543 be exploited remotely?
Yes, CVE-2021-3543 could potentially be exploited remotely if an attacker has access to affected kernel components.