Intro
This blog post will go through the basic setup of a Discord C2
Create a Discord Server
Creating a server is very easy
Click the green plus button at the bottom of your client
Click through all the options and give it a name
Now you have yourself a discord server
Create a Discord Bot
Open the Discord developer portal and log into your account https://discord.com/developers/applications
Click the “New Application” button in the top right
Enter in a name for your bot and click “Create”
I added in a picture for my bot, you can customsie it however you’d like but once you are happy click on the “Bot” section on the left. Once you are there click the “Add Bot” button and you have your first discord bot!
Add Bot to Server
To add a bot to your server go to the “OAuth2” section on the left and select “URL Generator”
On that screen check “bot” and “applications.commands”. Once they are clicked you can give your bot specific permissions. For testing, I gave it Administrator but at the bare minimum you will need the following:
- Send Messages
- Read Messages
- Attach Files
- Manage Server
Once you are happy you should have a URL at the bottom, copy it and, put it into your browser and you should see something like this
Select your new server and press continue. In just a moment you will see your bot in your server!
DiscordGo
DiscordGo will be the framework for this c2
On discord, you will need to enable developer options. To do this:
- Click the cog by your username at the bottom
- Under “App Settings” click “Advanced”
- Enable Developer Mode
Next, we need to get our server ID. Just go to your server and right-click the name in the top right and select “Copy ID”
The other piece of info we need is our bot Token. This is under our Bot Application Page
Install on kali
Make sure you have golang installed sudo apt install -y golang
Download the repo git clone https://github.com/emmaunel/DiscordGo
Edit the following file pkg/util/variables.go
and insert your Server ID and Bot Token
Execute make
and it will build
Inside the DiscordGo/bin
directory you will see a few binaries. I’ll transfer one over to a windows machine and execute the .exe
And we can see that the process is running
Checking back on discord we have the agent connect and we can run various commands