A threat actor can trigger a vulnerability, tracked as CVE-2023-43641 (CVSS score: 8.8), in the libcue library impacting GNOME Linux systems to achieve remote code execution (RCE) on affected hosts.
libcue provides an API for parsing and extracting data from CUE sheets.
The vulnerability is a memory corruption issue in the libcue library that impacts versions 2.2.1 and prior.
“Today, in coordination with Ilya Lipnitskiy (the maintainer of libcue) and the distros mailing list, the GitHub Security Lab is disclosing CVE-2023-43641, a memory corruption vulnerability in libcue. We have also sent a text-only version of this blog post to the oss-security list.” “It’s quite likely that you have never heard of libcue before, and are wondering why it’s important.” wrote Kevin Backhouse on GitHub.
libcue is incorporated into Tracker Miners which is a search engine tool included by default in GNOME that indexes files in the system for easy access.
The researchers noted that every time the user adds or modifies a file in certain subdirectories of its home directory the index is automatically updated.
That implies that inadvertently clicking a specially crafted link is all it takes for an attacker to exploit CVE-2023-43641 and get code execution on your computer.
The issue stems from two problems; the first issue is that the scanner (cue_scanner.l, line 132) uses atoi
to scan the integers. However, atoi does not check for integer overflow. The researcher pointed out that is possible to construct a negative index (i.e. 4294567296 is converted to -400000 by atoi)
The second problem is that track_set_index that does not check that i ≥ 0.
“If i is negative, then this code can write to an address outside the bounds of the array. Since the value of ind is also attacker-controlled, this is a very powerful vulnerability.” continues the post. “The bug is simple to fix by adding an extra condition to the if-statement in track_set_index.”
The flaw can be exploited by tricking a victim into clicking a malicious link and downloading a .cue file.
The researchers published a video PoC for an attack exploiting this issue. The video shows the researcher clicking a link in a webpage, which causes a cue sheet to be downloaded. The file is saved to the ~/Downloads folder, for reason, it is automatically scanned by tracker-miners which. Because the file has a .cue filename extension, it is parsed by the tracker-miners using the libcue library.
“The file exploits the vulnerability in libcue to gain code execution and pop a calculator. Cue sheets are just one of many file formats supported by tracker-miners. For example, it also includes scanners for HTML, JPEG, and PDF.” states the post.
“Sometimes a vulnerability in a seemingly innocuous library can have a large impact,” concludes Kevin Backhouse. “Due to the way that it’s used by tracker-miners, this vulnerability in libcue became a one-click RCE.”
Follow me on Twitter: @securityaffairs and Facebook and Mastodon
(SecurityAffairs – libcue library, Linux)