SlackPirate is a tool developed in Python which uses the native Slack APIs to extract ‘interesting’ information from a Slack workspace given an access token.
As of May 2018, Slack has over 8 million customers and that number is rapidly rising – the integration and ‘ChatOps’ possibilities are endless and allows teams (not just developers!) to create some really powerful workflows and Slack bot/application interactions.
As is the way with corporations large and small, it is not unusual for tools such as Slack to fly under the Information Security governance/policy radar which ultimately leads to precarious situations whereby sensitive and confidential information end up in places they shouldn’t be.
The purpose of this tool is two-fold:
The tool allows you to easily gather sensitive information for offline viewing at your convenience.
Note: I’m a Python n00b and have no doubt that the script can be optimized and improved massively – please feel free to make pull requests; I’ll review and merge them as appropriate!
Information Gathering
The tool uses the native Slack APIs to extract ‘interesting’ information and looks for the following information, today:
Slack Cookie
The Slack web application uses a number of cookies – the one of special interest is called, wait for it… d. This d cookie is the same across all Workspaces the victim has access to. What this means in reality is that a single stolen d cookie would allow an attacker to get access to all of the Workspaces the victim is logged-in to; my experience with the Slack web application is that once you are logged in, you’ll remain logged in indefinitely.
Slack Token
The Slack API token is a per-workspace token. One token cannot (as far as I know) access other workspaces in the same way the d cookie above allows access to all Workspaces.
For the tool to search for and extract information, you will need to provide it an API token. There are two straight forward ways of doing this:
d cookie by using the --cookie flag. The tool will output the associated Workspaces and tokens--token flag. You can find this by viewing the source of the Workspace URL and doing a search for XOXThe token will look something like this:
api_token: “xoxs-x-x-x-x”
Make a copy of that and pass that in to the script using the --token flag.
Building
The script has been developed, tested and confirmed working on Python 3.5, 3.6 and 3.7. A quick test on Python 2 presented some compatibility issues.
Linux with virtualenv
git clone https://github.com/emtunc/SlackPiratepip install virtualenvvirtualenv SlackPiratesource SlackPirate/bin/activatepip install -r requirements.txt./SlackPirate.py --helpLinux without virtualenv
git clone https://github.com/emtunc/SlackPiratechmod +x SlackPirate.pypip install -r requirements.txt./SlackPirate.py --helpWindows with virtualenv
git clone https://github.com/emtunc/SlackPiratepip install virtualenvvirtualenv SlackPirateSlackPirate\Scripts\activate.batpip install -r requirements.txtpython SlackPirate.py --helpUsage
python3 SlackPirate.py –help
Display the help menu - this includes information about all scan modules you can explicitly select or ignore
python3 SlackPirate.py –interactive
Interactive mode instructs the tool to allow you to provide a token or cookie, and choose scans to run through a console UI rather than via command line arguments.
python3 SlackPirate.py –cookie
This will do the following:
python3 SlackPirate.py –token
This will do the following:
python3 SlackPirate.py –token –s3-scan
This will instruct the tool to only run the S3 scan
python3 SlackPirate.py –token –no-s3-scan
This will instruct the tool to run all scans apart from the S3 scan
python3 SlackPirate.py –token –verbose
Verbose mode will output files in .CSV – will provide a lot more information such as channel names, usernames, perma-links and more.
Screenshots
General Working of a Web Application Firewall (WAF) A Web Application Firewall (WAF) acts as…
How to Send POST Requests Using curl in Linux If you work with APIs, servers,…
If you are a Linux user, you have probably seen commands like chmod 777 while…
Vim and Vi are among the most powerful text editors in the Linux world. They…
Working with compressed files is a common task for any Linux user. Whether you are…
In the digital era, an email address can reveal much more than just a contact…