CyberSecBulletin
CVE-2024-35791NVD status: Modified

Linux: Use After Free

CVE-2024-35791 is a high-severity use after free vulnerability in Linux, with a CVSS 3.1 base score of 7.8 out of 10. It can be exploited with local access to the system by an attacker with a low-privileged account, without any action from a user. The record lists versions 2d13b79640b147bd77c34a5998533b2021a4122d, e126b508ed2e616d679d85fca2fbe77bb48bbdd7, 4868c0ecdb6cfde7c70cf478c46e06bb9c7e5865 as the first without the flaw, so updating Linux to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.24% chance of exploitation within 30 days, which is low compared with other CVEs.

Next patch cycle

High severity with no evidence of exploitation so far.

What to do

  1. Update Linux to 2d13b79640b147bd77c34a5998533b2021a4122d or e126b508ed2e616d679d85fca2fbe77bb48bbdd7 or 4868c0ecdb6cfde7c70cf478c46e06bb9c7e5865 or 12f8e32a5a389a5d58afc67728c76e61beee1ad4, whichever matches your release line, or a later version.
  2. Update Linux Kernel to 4.20 or 5.5 or 5.10.215 or 5.15.154, whichever matches your release line, or a later version.

Affected products and versions

VendorProductAffected versionsFixed in
LinuxLinux4f627ecde7329e476a077bb0590db8f27bb8f912 up to, but not including, 2d13b79640b147bd77c34a5998533b2021a4122d; 19a23da53932bc8011220bd8c410cb76012de004 up to, but not including, e126b508ed2e616d679d85fca2fbe77bb48bbdd7; 19a23da53932bc8011220bd8c410cb76012de004 up to, but not including, 4868c0ecdb6cfde7c70cf478c46e06bb9c7e5865; 19a23da53932bc8011220bd8c410cb76012de004 up to, but not including, 12f8e32a5a389a5d58afc67728c76e61beee1ad4; 19a23da53932bc8011220bd8c410cb76012de004 up to, but not including, f6d53d8a2617dd58c89171a6b9610c470ebda38a; 19a23da53932bc8011220bd8c410cb76012de004 up to, but not including, 5ef1d8c1ddbf696e47b226e11888eaf8d9e8e807; f1ecde00ce1694597f923f0d25f7a797c5243d99; 848bcb0a1d96f67d075465667d3a1ad4af56311e; and 4 more ranges2d13b79640b147bd77c34a5998533b2021a4122d, e126b508ed2e616d679d85fca2fbe77bb48bbdd7, 4868c0ecdb6cfde7c70cf478c46e06bb9c7e5865, 12f8e32a5a389a5d58afc67728c76e61beee1ad4, f6d53d8a2617dd58c89171a6b9610c470ebda38a, 5ef1d8c1ddbf696e47b226e11888eaf8d9e8e807
LinuxLinux Kernel4.19.176 up to, but not including, 4.20; 5.4.98 up to, but not including, 5.5; 5.10.15 up to, but not including, 5.10.215; 5.11.1 up to, but not including, 5.15.154; 5.16 up to, but not including, 6.1.84; 6.2 up to, but not including, 6.6.24; 6.7 up to, but not including, 6.7.12; 5.11; and 1 more ranges4.20, 5.5, 5.10.215, 5.15.154, 6.1.84, 6.6.24
DebianDebian Linux10.0Not stated

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
LocalThe attacker needs local access or must trick a user into running something.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
LowA basic user account is enough.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.

Scoring systemScoreSeverityScored by
CVSS 3.17.8HighCNA
CVSS 3.17.8HighNVD

Official description

In the Linux kernel, the following vulnerability has been resolved: KVM: SVM: Flush pages under kvm->lock to fix UAF in svm_register_enc_region() Do the cache flush of converted pages in svm_register_enc_region() before dropping kvm->lock to fix use-after-free issues where region and/or its array of pages could be freed by a different task, e.g. if userspace has __unregister_enc_region_locked() already queued up for the region. Note, the "obvious" alternative of using local variables doesn't fully resolve the bug, as region->pages is also dynamically allocated. I.e. the region structure itself would be fine, but region->pages could be freed. Flushing multiple pages under kvm->lock is unfortunate, but the entire flow is a rare slow path, and the manual flush is only needed on CPUs that lack coherency for encrypted memory.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Use After Free

The product reuses or references memory after it has been freed. At some point afterward, the memory may be allocated again and saved in another pointer, while the original pointer references a location somewhere within the new allocation. Any operations using the original pointer are no longer valid because the memory belongs to the code that operates on the new pointer.

How developers prevent this class of flaw

  • Choose a language that provides automatic memory management.
  • When freeing pointers, be sure to set them to NULL once they are freed. However, the utilization of multiple or complex data structures may lower the usefulness of this strategy.

More Use After Free vulnerabilities (CWE-416)

Timeline

  1. CVE record published.
  2. CISA published its SSVC assessment (exploitation: none, automatable: no, technical impact: partial).
  3. Record last changed materially (score, affected products, status or references).

References

Third-party and government advisories

Recent Use After Free vulnerabilities

Spotted an error? Tell us.