Overview
The goal of this blog post is to show how to deploy sliver c2
in an automated way on AWS ec2 using Hashicorp terraform.
sliver and it’s dependencies are installed using a bash shell script. Configuration and State management tools like Chef/Ansible would be more suited for this task but that would go beyond the scope of this introductory post.
All scripts can be found on github.
Sliver is a Command and Control (C2) system made for penetration testers, red teams, and blue teams. It generates implants that can run on virtually every architecture out there, and securely manage these connections through a central server. Sliver supports multiple callback protocols including DNS, Mutual TLS (mTLS), WireGuard, and HTTP(S) to make egress simple, even when those pesky blue teams block your domains. You can even have multiple operators (players) simultaneously commanding your sliver army.
Architecture
Please note: We are exposing the C2 server directly and don’t use redirectors for simplicity in this blog post.
Installation
This blog post assumes that terraform and the necessary AWS credentials to deploy infrastructure is already configured.
The file main.tf
creates a AWS EC2 t2.micro instance in the default VPC in eu-central-1. Sliver is being installed using the sliverc2-bootstrap.sh
bash script using terraforms remote-exec
feature. Network access to the EC2 instance is controlled using security groups. Port 22, 80 and 443 is automatically whitelisted to the current source ip of the terraform execution environment using cloudflare’s https://icanhazip.com service (see variables.tf
). In addition, a AWS Route53 Zone gets updated with the public IP of the AWS EC2 maschine, see variables.tf
The instance should be ready, bundled with MSF and sliver after about ~3 minutes.
Basic sliver usage:
Connect to the EC2 instance using the prepared ssh key pair and interact with sliver:
- Start HTTP and HTTPS listener.
- Generate a example beacon.
- Download & execute beacon.
Architecture deployed through Terraform can be destroyed using terraform destroy
.
The next post will look into slivers features such as socks5 proxy, armory, and more. To be continued.
Further ressources:
Automating Red Teaming infrastructure deployment is not a new topic, below are several interesting blog posts covering this topic in depth: