Skip to content
RCE Disclosed report Intermediate

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.

metnew Follow

Originally disclosed on HackerOne

High 7.3 View original
  • 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.quarantine meta-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

  1. Opening leads to command execution.
  2. Looks safe - XML file.
  3. Downloaded .terminal file couldn't be opened if application sets quarantine meta-attribute properly. However, Slack (Direct Download) doesn't do that.

Attack scenario

  1. Attacker sends exploit.terminal to the victim. File looks like a plaintext file in preview.
  2. Victim opens exploit.terminal file via "Shift + Click" (or via Finder)
  3. No alert from Gatekeeper about unsigned executable
  4. No alert about running executable file downloaded from the web
  5. Shell commands from exploit.terminal get 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.terminal is 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

______________2018-12-21___6.36.02___.mov From the original on HackerOne

The original report as published on HackerOne, by metnew. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

  1. The attacker sends a .terminal file to the victim through Slack.
  2. The victim opens the file with Shift + Click or from Finder.
  3. No Gatekeeper alert appears for the unsigned executable or for a file downloaded from the web.
  4. 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.

More by metnew

View all

25 more disclosed reports, best first.

More from Slack

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.