Skip to content
XSS Disclosed report Beginner

Executing scripts on slack-files.com using SVG

Slack served user-uploaded SVG files from its file-hosting domain in a way that let scripts embedded in the SVG run in the browser. An attacker could upload a crafted SVG and get a victim to click it, executing script on the slack-files.com origin and enabling convincing phishing pages.

kamil_hism Follow

Originally disclosed on HackerOne

  • Fixed in 2 months
  • Disclosed after 3 months

Impact

Although slack-files.com is a sandbox domain, there are many ways to gain the victim's trust during phishing attack. For example, an attacker might render a fake log-in form with "You need to sign in to see this file" message and trick users into handing out their passwords.

Steps to reproduce

  1. Download attached to report or use the following code snippet to create SVG file:
JavaScript
<svg width="100%" height="100%" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" onload="alert('script')">
  <script type="text/javascript"><![CDATA[
  // some exploit code here
  ]]></script>

  <circle cx="50" cy="50" r="50" fill="green" />
</svg>

A SVG script and other DOM elements is equivalent to the elements in HTML, so in the example above alert('script') will be executed on svg load event.

  1. Upload constructed SVG file to some channel or dm in Slack.

  2. Click on message with just uploaded file.

Observed

Clicking on message opens a new tab and navigates user to slack-files.com. Once SVG loaded the alert('script') is executing.

Also this file can be shared via public link. In this case victim should click on image preview to start script execute.

Expected

Users expect that after clicking on message with file they will see this file or file will be downloaded.

Possible fix

There are three ways:

The original report as published on HackerOne, by kamil_hism. 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 the file host served uploaded SVG files with an image/svg+xml content type and no Content-Security-Policy or attachment disposition, so inline scripts inside the SVG executed in the browser.

Impact

Script execution on the slack-files.com origin could be used in phishing, for example by rendering a fake sign-in form to steal passwords; the domain is a sandbox, which limits what the script can reach.

What the attacker needed

A Slack account able to upload files; victim clicks the file message

The fix

Serve SVG attachments with a restrictive Content-Security-Policy, or as text/plain, or with a Content-Disposition attachment header so browsers download rather than render them.

How it was found

  1. Create an SVG file that contains an onload handler and a script block.
  2. Upload the SVG to a Slack channel or direct message.
  3. Click the message containing the uploaded file.
  4. The file opens in a new tab on slack-files.com and the script runs once the SVG loads.

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.

An SVG is an image format that can also contain scripts. If a website shows such a file directly in the browser instead of downloading it, the script inside the image runs as if it were part of that website. Here the file was hosted on a Slack domain, so the script ran there and could be used to show a fake login page.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Slack

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.