Stored XSS on Slack, Bug Bounty
Slack used an outdated version of PDF.js that was vulnerable to CVE-2018-5158, allowing JavaScript in a PDF to execute when viewed. An attacker could upload a malicious PDF to a chat, and when a victim clicked it, the script ran and could steal session cookies.
Published on medium.com
This was my first XSS related finding that was considered a high severity vulnerability on a bug bounty program. For finding this vulnerability I was paid a bounty of $4,875.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely Slack was using an outdated version of the PDF.js library that was vulnerable to CVE-2018-5158, which allows JavaScript in a PDF to execute.
Impact
An attacker could execute JavaScript in the context of Slack and steal the victim's session cookies, potentially leading to account takeover.
What the attacker needed
Victim clicks the malicious PDF; attacker can upload a PDF to a chat
How it was found
- Upload a PDF file containing JavaScript code to a Slack chat.
- Get the victim to click on the uploaded PDF.
- The PDF opens in Slack's PDF viewer and the JavaScript executes.
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 write-up has not been written yet. The Original tab links to the source.
PDF files can contain JavaScript, and if the program that displays the PDF is old and has a known bug, that script can run as if it were part of the website. Here, Slack's PDF viewer was outdated, so a malicious PDF uploaded to a chat could run code in the victim's browser and read their cookies, which are small pieces of data that keep you logged in.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.