User-assisted RCE in Slack for macOS (from official site) due to improper quarantine meta-attribute handling for downloaded files
Slack for macOS downloaded files without setting the com.apple.quarantine attribute, so a .terminal file sent by an attacker would run shell commands with user privileges when opened, without Gatekeeper warnings. The attacker could therefore execute code on the victim's machine after the victim opened the file.
- Triaged in 38 days
- Fixed in 8 months
- Paid in 6 months
- Disclosed after 9 months
Summary
GateKeeper/Quarantine bypass for downloaded files
Lack of com.apple.quarantine meta-attribute for downloaded files allows a remote attacker to send an executable file that won't be checked by Gatekeeper .
File opening doesn't trigger native alerts from GateKeeper/Quarantine
Downloaded executable files lack
com.apple.quarantinemeta-attribute => no alerts about launching an executable from the web will appear.
Code execution after opening
Opening a downloaded .terminal file in Slack via "Shift + Click" (or in Finder) immediately leads to running attacker's code on a target device.
.terminal file
- Opening leads to command execution.
- Looks safe - XML file.
- Downloaded
.terminalfile couldn't be opened if application sets quarantine meta-attribute properly. However, Slack (Direct Download) doesn't do that.
Attack scenario
- Attacker sends
exploit.terminalto the victim. File looks like a plaintext file in preview. - Victim opens
exploit.terminalfile via "Shift + Click" (or via Finder) - No alert from Gatekeeper about unsigned executable
- No alert about running executable file downloaded from the web
- Shell commands from
exploit.terminalget executed with user-level privileges.
Version
Decribed scenario is reproducible in Slack 3.3.3 Direct Download. Slack from AppStore has correct quarantine rules and isn't vulnerable.
Additional details
exploit.terminal attached + Screencast attached.
Quarantine
macOS is build in such way that OS will ask user before opening any downloaded and potentially launchable (in default setup) files. This rule applies to .terminal files too.
TL;DR:
- no quarantine ->
exploit.terminalis launchable in 1 click without warning a user with popups - quarantine -> no immediate launch for all files (2 popups) + no RCE is possible if GateKeeper level set to "AppStore only"
Impact
Impact
Attacker could send a crafted .terminal file to the victim, which will be executed immediately after opening this file via "Open" button or in Finder.
The attack scenario requires a certain level of user interaction. But the file looks safe and the victim doesn't expect that it'll be launched immediately
Additional Impact
GateKeeper bypass allows running arbitrary apps in environments hardened with Gatekeeper settings set to "AppStore only".
Attachments
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely Slack's direct-download build saved downloaded files without applying the com.apple.quarantine extended attribute, so Gatekeeper never inspected or warned about them.
Impact
An attacker could run arbitrary code with the victim's privileges after the victim opened the file, and could also run apps in environments hardened to AppStore-only Gatekeeper settings; the attack needs user interaction, and the AppStore version of Slack is not affected.
What the attacker needed
Slack 3.3.3 Direct Download build; Victim opens the sent file; Attacker can message the victim
How it was found
- The attacker sends a .terminal file to the victim through Slack.
- The victim opens the file with Shift + Click or from Finder.
- No Gatekeeper alert appears for the unsigned executable or for a file downloaded from the web.
- The shell commands inside the file run with the victim's user-level privileges.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
macOS normally marks files downloaded from the internet with a hidden label called the quarantine attribute, and Gatekeeper uses that label to warn you before opening something that could run code. Here Slack saved downloaded files without that label, so a file that runs commands looked like an ordinary document and opened without any warning. The victim still had to open the file, but nothing told them it was dangerous.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.