Bugzilla – Bug 1213985
VUL-0: CVE-2023-43783: Cadence: Use of Fixed Temporary File Path in /tmp/cadence-wineasio.reg
Last modified: 2023-10-04 08:03:12 UTC
+++ This bug was initially created as a clone of Bug #1213330 I just reported this to upstream via email: This file is used if Wine is installed on the system and when the Wine ASIO related settings are changed and applied in the Cadence GUI dialog. In Cadence.py the following code deals with it: ``` if "wineasio" in self.settings_changed_types: REGFILE = 'REGEDIT4\n' REGFILE += '\n' REGFILE += '[HKEY_CURRENT_USER\Software\Wine\WineASIO]\n' REGFILE += '"Autostart server"=dword:0000000%i\n' % int(1 if self.cb_wineasio_autostart.isChecked() else 0) REGFILE += '"Connect to hardware"=dword:0000000%i\n' % int(1 if self.cb_wineasio_hw.isChecked() else 0) REGFILE += '"Fixed buffersize"=dword:0000000%i\n' % int(1 if self.cb_wineasio_fixed_bsize.isChecked() else 0) REGFILE += '"Number of inputs"=dword:000000%s\n' % smartHex(self.sb_wineasio_ins.value(), 2) REGFILE += '"Number of outputs"=dword:000000%s\n' % smartHex(self.sb_wineasio_outs.value(), 2) REGFILE += '"Preferred buffersize"=dword:0000%s\n' % smartHex(int(self.cb_wineasio_bsizes.currentText()), 4) writeFile = open("/tmp/cadence-wineasio.reg", "w") writeFile.write(REGFILE) writeFile.close() os.system("regedit /tmp/cadence-wineasio.reg") ``` Without the Linux kernel's symlink protection (`fs.protected_symlinks` sysctl) this would allow other users to stage a symlink attack. Thus other users could point /tmp/cadence-wineasio.reg to a compromised file, or have the user running Cadence create this file in an arbitrary location. Without the Linux kernel's regular file proection (`fs.protected_regular` sysctl) this would allow other users to place an attacker controlled world-writable file in this location. By winning a race condition (waiting for Cadence to write its desired content and then quickly replacing the file's content again) the attacker can cause arbitrary data to be passed to `regedit`. Since the Wine registry controls ample application behaviour this can be considered a local arbitrary code execution. Luckily most modern Linux distrubtions have the kernel protections mentioned above enabled which means that the worst case will usually not happen. Even with these protection mechanisms the following problems remain: - Cadence can be prevented from saving Wine ASIO settings by pre-creating this file. - The file is created world-readable by Cadence, thus the content of the file can leak to other user contexts on the system. The data that is written there is not sensitive at the moment, but it could become problematic in in the future. - (non-security) the fixed /tmp file path makes it impossible to properly run two instances of Cadence in parallel, especially since the file is never deleted again. The fix for this one is easy, this needs to use Python's `tempfile.NamedTemporaryFile`.
Created attachment 868937 [details] fix for the issue
While the upstream author still didn't reply to my suggestions he now actually archived the Cadence GitHub repository. So he seems to be serious about decomissioning the project. This means I won't be able to offer a PR# to upstream and there won't be an upstream maintenance release with the fixes. I'm calling off the embargo and I attached a patch containing a fix for the issue in attachment 868937 [details]. Simon, can you please start updates / maintenance updates containing this fix? For Tumbleweed, Leap 15.4 and Leap 15.5. Given the situation we should also think about a route to drop Cadence in the mid term, since it obviously has no upstream any longer. I will keep this bug private until the update process is started. Then I will publish a formal report on the oss-security mailing list to make other packagers aware of the problem.
This is an autogenerated message for OBS integration: This bug (1213985) was mentioned in https://build.opensuse.org/request/show/1109220 Backports:SLE-15-SP4 / Cadence
Should be fixed everywhere now, sorry for the delay.
This is an autogenerated message for OBS integration: This bug (1213985) was mentioned in https://build.opensuse.org/request/show/1109233 Backports:SLE-15-SP5 / Cadence
Publishing this bug to serve as a reference for requesting a CVE for this issue from Mitre.
openSUSE-RU-2023:0258-1: An update that has three recommended fixes can now be installed. Category: recommended (moderate) Bug References: 1213330,1213983,1213985 CVE References: JIRA References: Sources used: openSUSE Backports SLE-15-SP5 (src): Cadence-0.9.2-bp155.2.3.1
openSUSE-SU-2023:0270-1: An update that contains security fixes can now be installed. Category: security (moderate) Bug References: 1213330,1213983,1213985 CVE References: JIRA References: Sources used: openSUSE Backports SLE-15-SP4 (src): Cadence-0.9.1-bp154.2.3.1
All fixed and published. Closing bug report.