CVE-2023-1118: Use After Free
A flaw in the Linux Kernel found. There are use-after-free vulnerabilities in drivers/media/rc/eneir.c of linux that allow attacker to crash linux kernel without any privilege by detaching rc device.
When the rc device is detaching, function eneremove() will be called. But the synchronizations in eneremove() are bad. The situations that may lead to race conditions are shown below.
Firstly, the rx receiver is disabled with enerxdisable() before rcunregisterdevice() in eneremove(), which means it can be enabled again if a process opens /dev/lirc0 between enerxdisable() and rcunregisterdevice().
(cleanup routine) | (open routine) eneremove() | enerxdisable(dev); | eneopen() | enerxenable(dev); //re-enable!
Secondly, the irqaction descriptor is freed by freeirq() before the rc device is unregistered, which means irqaction descriptor may be accessed again after it is deallocated.
(free routine) | (use routine) eneremove() | enerxenable() freeirq(dev->irq, ...); //FREE | enerxenablehw() | enewritereg(..., dev->irq << 1) //USE |
Thirdly, the timer can call enetxsample() that can write to the io ports, which means the io ports could be accessed again after they are deallocated by releaseregion().
(free routine) | (use routine) eneremove() | enetxsample() releaseregion(dev->hwio, ...); //FREE | enewritereg() | outb(..., dev->hwio + ENEIO) //USE
Fourthly, there is no function to cancel txsimtimer in eneremove(), the timer handler enetxirqsim() could race with eneremove(). As a result, the UAF bugs could happen, the process is shown below.
(free routine) | (use routine) | modtimer(&dev->txsimtimer, ..) eneremove() | (wait a time) kfree(dev) //FREE | enetxirqsim() | dev->hwlock //USE | enetxsample(dev) //USE
------------------------------------------
Reference: https://github.com/torvalds/linux/commit/29b0589a865b6f66d141d79b2dd1373e4e50fe17
Other sources
A flaw use after free in the Linux kernel integrated infrared receiver/transceiver driver was found in the way user detaching rc device. A local user could use this flaw to crash the system or potentially escalate their privileges on the system.
A use-after-free flaw was found in the Linux kernel's integrated infrared receiver/transceiver driver. This issue occurs when a user detaches a rc device. This could allow a local user to crash the system or potentially escalate their privileges on the system.
Linux Kernel is vulnerable to a denial of service, caused by a use-after-free flaw in drivers/media/rc/eneir.c. By sending a specially-crafted request, a local attacker could exploit this vulnerability to cause the kernel to crash.
— IBM
Affected Software
Remediation
Information
Event History
Frequently Asked Questions
What is the severity of CVE-2023-1118?
CVE-2023-1118 is classified as a high severity vulnerability due to its potential to cause kernel crashes.
How do I fix CVE-2023-1118?
To fix CVE-2023-1118, upgrade to the Linux kernel version 6.3 or later.
Which versions of the Linux kernel are affected by CVE-2023-1118?
CVE-2023-1118 affects Linux kernel versions prior to 6.3 and various versions between 2.6.36 and 6.2.3.
Can CVE-2023-1118 be exploited remotely?
Yes, CVE-2023-1118 can be exploited remotely without any privileges by detaching an RC device.
What component in the Linux kernel is vulnerable in CVE-2023-1118?
The vulnerability CVE-2023-1118 is found in the drivers/media/rc/ene_ir.c component of the Linux kernel.