CVE-2024-36899: Linux Kernel - Use After Free
- Cve: CVE-2024-36899
- Name: Linux Kernel - Use After Free
- Description: In the Linux kernel, the following vulnerability has been resolved: gpiolib: cdev: Fix use after free in lineinfo_changed_notify The use-after-free issue occurs as follows: when the GPIO chip device file is being closed by invoking gpio_chrdev_release(), watched_lines is freed by bitmap_free(), but the unregistration of lineinfo_changed_nb notifier chain failed due to waiting write rwsem. Additionally, one of the GPIO chip's lines is also in the release process and holds the notifier chain's read rwsem. Consequently, a race condition leads to the use-after-free of watched_lines. Here is the typical stack when issue happened: [free] gpio_chrdev_release() --> bitmap_free(cdev->watched_lines) <-- freed --> blocking_notifier_chain_unregister() --> down_write(&nh->rwsem) <-- waiting rwsem --> __down_write_common() --> rwsem_down_write_slowpath() --> schedule_preempt_disabled() --> schedule() [use] st54spi_gpio_dev_release() --> gpio_free() --> gpiod_free() --> gpiod_free_commit() --> gpiod_line_state_notify() --> blocking_notifier_call_chain() --> down_read(&nh->rwsem); <-- held rwsem --> notifier_call_chain() --> lineinfo_changed_notify() --> test_bit(xxxx, cdev->watched_lines) <-- use after free The side effect of the use-after-free issue is that a GPIO line event is being generated for userspace where it shouldn't. However, since the chrdev is being closed, userspace won't have the chance to read that event anyway. To fix the issue, call the bitmap_free() function after the unregistration of lineinfo_changed_nb notifier chain.
- Impact: Potential kernel panic or arbitrary code execution due to use-after-free during GPIO event notification.
- Remediation: Call bitmap_free() after unregistering lineinfo_changed_nb notifier chain to prevent use-after-free.
- Vulnerability type: use_after_free
- Vulnerability impact: remote_code_execution, denial_of_service
- Requirement type: none
- Labels source: projectdiscovery
- Severity: high
- Cvss score: 7
- Cvss vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
- Epss score: 0.00179
- Epss percentile: 0.07471
- Assignee: 416baaa9-dc9f-4396-8d5f-8c081fb06d67
- Published at: 2024-05-30T16:15:13Z
- Age in days: 908
- Modified at: 2026-10-15T01:18:23Z
- Patch available: yes
- References total: 9
- Products total: 1
- Oss: yes
- Projects total: 1
- Advisory url: https://nvd.nist.gov/vuln/detail/CVE-2024-36899
- Nvd status: modified
- Checked, none or zero: known exploited entries, nuclei templates, public exploits total, public exploits capped, public exploits, rejected by nvd
- Not known: requirements, hackerone
Cwe
| Id | Name |
|---|---|
| CWE-362 | Concurrent Execution using Shared Resource with Improper Synchronization |
References
Same in every row:
- Source: nvd
Products
| Product | Affected | Platform bound | Sources | Url |
|---|---|---|---|---|
| linux:linux_kernel | = 6.9 rc7; = 6.9 rc1; = 6.9 rc2; = 6.9 rc3; = 6.9 rc4; = 6.9 rc5; = 6.9 rc6; >= 6.7, < 6.8.10; >= 5.7, < 6.6.31 | no | nvd | /v1/products/linux/linux_kernel |
Projects
| Repository | Link kinds | Indexed | Url |
|---|---|---|---|
| torvalds/linux | cna_commit, commit | yes | /v1/repositories/torvalds/linux |
Index
- Checked, none or zero: repositories, repositories high signal, packages
Exploitation
- Authentication required: yes
- Exposed hosts: 10038339
- Checked, none or zero: known exploited, known exploited by, exploitation seen, public exploit, public exploit count, initial access, remote
- Not known: known exploited since, vulncheck known exploited since, public exploit first date, nuclei template, initial access since, hackerone reports