Bug 1213985 - VUL-0: CVE-2023-43783: Cadence: Use of Fixed Temporary File Path in /tmp/cadence-wineasio.reg
Summary: VUL-0: CVE-2023-43783: Cadence: Use of Fixed Temporary File Path in /tmp/cade...
Status: RESOLVED FIXED
Alias: None
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL: [none]
Whiteboard:
Keywords:
Depends on:
Blocks: 1213330
  Show dependency treegraph
 
Reported: 2023-08-04 12:31 UTC by Matthias Gerstner
Modified: 2023-10-04 08:03 UTC (History)
2 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
fix for the issue (1.77 KB, text/x-diff)
2023-08-22 13:01 UTC, Matthias Gerstner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Gerstner 2023-08-04 12:31:36 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`.
Comment 4 Matthias Gerstner 2023-08-22 13:01:10 UTC
Created attachment 868937 [details]
fix for the issue
Comment 5 Matthias Gerstner 2023-08-22 13:08:39 UTC
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.
Comment 6 OBSbugzilla Bot 2023-09-06 09:25:05 UTC
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
Comment 7 Simon Lees 2023-09-06 09:49:07 UTC
Should be fixed everywhere now, sorry for the delay.
Comment 8 OBSbugzilla Bot 2023-09-06 10:05:04 UTC
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
Comment 9 Matthias Gerstner 2023-09-06 10:47:32 UTC
Publishing this bug to serve as a reference for requesting a CVE for this
issue from Mitre.
Comment 10 Marcus Meissner 2023-09-25 16:07:12 UTC
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
Comment 11 Marcus Meissner 2023-09-26 01:07:48 UTC
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
Comment 12 Alexander Bergmann 2023-10-04 08:03:12 UTC
All fixed and published. Closing bug report.