CVE-2021-46988

Medium

In the Linux kernel, the following vulnerability has been resolved: userfaultfd: release page in error path to avoid BUG_ON Consider the following sequence of events: 1. Userspace issues a UFFD ioctl, which ends up calling into shmem_mfill_atomic_pte(). We successfully account the blocks, we shmem_alloc_page(), but then the copy_from_user() fails. We return -ENOENT. We don't release the page we allocated. 2. Our caller detects this error code, tries the copy_from_user() after dropping the mmap_lock, and retries, calling back into shmem_mfill_atomic_pte(). 3. Meanwhile, let's say another process filled up the tmpfs being used. 4. So shmem_mfill_atomic_pte() fails to account blocks this time, and immediately returns - without releasing the page. This triggers a BUG_ON in our caller, which asserts that the page should always be consumed, unless -ENOENT is returned. To fix this, detect if we have such a "dangling" page when accounting fails, and if so, release it before returning.

Package Linux Kernel
Published 2024-02-28
Last modified 2024-12-26
CVSS version 3.1
Patch available
Yes

CVSS 3.1 score

5.5

out of 10
Medium
Attack Vector
Local
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
High
Vector string
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

Weakness type

CWE-416

CVE-2021-46988 is a Use After Free vulnerability

What is Use After Free?

The product references memory after it has been freed, which may cause it to crash, use unexpected values, or execute code. Learn more on MITRE CWE

Affected versions

Linux kernel versions 4.11 and later are affected. Fixed in 4.14.233, 4.19.191, 5.4.120, 5.10.38, 5.11.22, 5.12.5, 5.13 and their respective stable series.

Affected from
≥ 4.11
Fixed in
✓ 4.14.233 4.14.x ✓ 4.19.191 4.19.x ✓ 5.4.120 5.4.x ✓ 5.10.38 5.10.x ✓ 5.11.22 5.11.x ✓ 5.12.5 5.12.x ✓ 5.13

Frequently asked questions

  • What is CVE-2021-46988?

    CVE-2021-46988 is a Medium severity Linux kernel vulnerability with a CVSS score of 5.5 out of 10 , classified as an Use After Free flaw (CWE-416) . It affects Linux kernel versions from 4.11 onward and has been patched in 4.14.233, 4.19.191, 5.4.120 and others. CVE-2021-46988 has not been confirmed as actively exploited and is not listed in the CISA KEV catalog.

  • What is the CVSS score for CVE-2021-46988?

    CVE-2021-46988 has a CVSS score of 5.5 out of 10, rated Medium severity (CVSS 3.1). The vector string is CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H .

  • Is there a patch available for CVE-2021-46988?

    Yes. CVE-2021-46988 has been patched. Fixed versions include 4.14.233, 4.19.191, 5.4.120 and others. If you are running Linux kernel 4.11 or later up to the fix versions, apply the relevant patch for your kernel branch.

  • Is CVE-2021-46988 actively exploited?

    No. CVE-2021-46988 has not been confirmed as actively exploited. It is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.