Wouldn’t it be great if there was a convenient way to securely network your on-prem and cloud assets? Well, you’re in the right place! If you’re as passionate about network security as I am, read on to learn more about securing your offensive tools.
Hey, hi, hello 👋 Welcome to LevelUp! My name is Rami (drunkrhin0). I’m a Security Solutions Architect at Bugcrowd, but I was actually hired from the crowd! Prior to information security, my background primarily stems from infrastructure, networking, and architecture. This laid a strong foundation for me by learning to build first and break later. This helps me find those unique attack angles that many others may not take the same approach to.
My experience in the bug bounty community has demonstrated that many of the best bounty hunters know how to get P1s, but they lack the experience when it comes to networking and securing their own infrastructure.
Securing your offensive tools is vital, not only for your protection of the data you’ve worked so hard to obtain, but to safeguard the data of the organizations you’re hunting on. Everyone learns differently and today I’ll demonstrate how you can leverage network security to level up your bounty game….sorry I won’t make that pun again.
Before we begin it’s worth noting, everything shown in this LevelUp is for demonstration purposes. This tutorial doesn’t have to be strictly adhered to and everything shown here is very flexible!
With that out of the way, you’ll need a free Tailscale account and at least two devices of your choice. I’ll be using the following:
A couple of months ago, a friend introduced me to Tailscale and it revolutionized my recon workflow without sacrificing security. I quickly incorporated it alongside other utilities like UFW (Uncomplicated FireWall).
Tailscale is a WireGuard based zero config software defined network allowing you to access your infrastructure from anywhere. It’s easy to set up without all the annoyances of traditional networking like port forwarding.
Personally, I use Tailscale to connect my computers, home lab, and cloud servers. It’s incredibly convenient to be able to access my resources securely from anywhere, without having to worry about exposing them to the public internet.
As security professionals, Tailscale is a game-changer. It allows us to build and manage secure networks without the hassle of traditional networking. In this guide, I’ll walk you through how to set up Tailscale for your bug bounty recon.
ssh <username>@100.x.y.z address>
Great! Now you have secure access and a networked set of devices, but we still need to set up our VPS and lock it down! 🔒
Go through the motions of basic setup. If you already have a VPS, set up feel free to skip this section!
root@123.456.789.012
apt update -y; apt upgrade -y;
adduser USERNAME
usermod -aG sudo USERNAME
USERNAME@123.456.789.012
This step is optional and primarily for demonstration purposes. If you’d like to skip this section, create a file on your VPS and call it tailscaledemo.txt
tailscaledemo.txt
Install your toolkit of choice. We’re gonna keep it simple here and install Amass. If you want to learn how to use Amass, I recommend checking their helpful tutorial.
# Download Amass wget https://github.com/owasp-amass/amass/releases/download/v4.2.0/amass_Linux_amd64.zip
# Download Unzip sudo apt-get install unzip
# Download Unzip
sudo apt-get install unzip
# Unzip Amass unzip amass_linux_amd64.zip
# Unzip Amass
unzip amass_linux_amd64.zip
# Remove the zip rm amass_linux_amd64.zip
# Remove the zip
rm amass_linux_amd64.zip
# Rename Amass and move it to PATH folder< cd amass_linux_amd64 sudo mv amass /usr/local/bin
# Rename Amass and move it to PATH folder<
cd amass_linux_amd64 sudo mv amass /usr/local/bin
# Cleanup cd .. rm -rf amass
# Cleanup
cd ..
rm -rf amass
# Add Amass to path nano ~/.bashrc export PATH="$PATH:/usr/local/bin" # add to the bottom then save and exit source ~/.bashrc
# Add Amass to path
nano ~/.bashrc
export PATH="$PATH:/usr/local/bin" # add to the bottom then save and exit
source ~/.bashrc
# Validate amass is in your PATH amass -version
# Validate amass is in your PATH
amass -version
Next, select your favorite bounty target from the engagements page.
amass enum -passive -d bugcrowd.com -o amass_output.txt
cat amass_output.txt
Now that you’re familiar with Tailscale, let’s install it on your recon VPS.
curl -fsSL <https://tailscale.com/install.sh> | sh
sudo tailscale up
Ping one of your other devices connected to Tailscale: ping mobiledevice
ping mobiledevice
If you’re familiar with most Linux distros, you’re likely familiar with Uncomplicated FireWall (UFW). Like the name says, it’s a basic firewall that’s more than sufficient for our needs here and it’s installed by default on Ubuntu. Since we’ve set up networking and remote access through Tailscale, our VPS doesn’t need to be public to the whole world anymore. We’ll use some basic firewall rules to achieve this:
# Enable firewall rules sudo ufw default deny incoming # Deny incoming traffic sudo ufw default allow outgoing # Allow outgoing traffic sudo ufw allow in on tailscale0 # Allow access through Tailscale
# Enable firewall rules
sudo ufw default deny incoming # Deny incoming traffic
sudo ufw default allow outgoing # Allow outgoing traffic
sudo ufw allow in on tailscale0 # Allow access through Tailscale
Enable UFW
sudo ufw enable # Enable UFW sudo ufw status verbose # View verbose UFW rules sudo ufw reload # Reload UFW sudo service ssh restart # Restart SSH
sudo ufw enable # Enable UFW
sudo ufw status verbose # View verbose UFW rules
sudo ufw reload # Reload UFW
sudo service ssh restart # Restart SSH
Exit your existing SSH session (public IP) and attempt to SSH again. If successful it will timeout.
Reconnect your SSH session with your tailscale hostname/IP address: ssh drunkrhin0@reconbox
ssh drunkrhin0@reconbox
Tailscale exit nodes are your egress points in your Tailscale network, allowing you to route all your traffic through a specific device on your Tailnet (your Tailscale network), similar to how a firewall works in traditional networking. Through this process, we’re going to anonymize traffic from our other devices to always appear as the exit node, similar to how consumer VPNs work. The diagram below by Tailscale shows this in an easy to understand way:
For systems that may not use /etc/sysctl.d check the docs here.
/etc/sysctl.d
// Enable IP Forwarding - Linux with /etc/sysctl.d (Ubuntu) echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
2. Advertise the VPS as an exit node: sudo tailscale up --advertise-exit-node
sudo tailscale up --advertise-exit-node
3. Navigate to the Tailscale admin console and you’ll notice there’s an exit-node label under your VPS now. That means we did it correctly. Click the 3 dots and click Edit route settings….
exit-node
4. Tick the Use as exit node checkbox and click Save.
5. On another Tailscale connected device, select your VPS as an exit node and lookup your public IP address.
Taildrive allows you to share folders with other users and devices on your Tailnet. Remember the Amass scan we just ran? Once configured you can access it from other devices by navigating to: /yourtailnetdomain.com/yourVPS/yourUSER. Let’s go ahead and set it up!
/yourtailnetdomain.com/yourVPS/yourUSER
// Enable Taildrive - Allow all devices to share directories and access shared directories
"nodeAttrs": [ { "target": ["autogroup:member"], "attr": [ "drive:share", "drive:access", ], } ]
3. Define sharing permissions below the node attributes you just inserted.
// Enable Taildrive // Enable broad sharing permissions
"grants": [ { "src": ["*"], "dst": ["*"], "app": { "tailscale.com/cap/drive": [{ "shares": ["*"], "access": "rw" }] } } ]
4. Click Save.
5. Share your VPS directory: tailscale drive share <share-name> <path>
tailscale drive share <share-name> <path>
drunkrhin0@localhost:~$ tailscale drive share reconbox ~/ Sharing "/home/drunkrhin0/" as "reconbox"
If you are using a different OS, check out the docs here
This process is similar to setting up a local network drive. We’re going to strictly follow the official docs below:
http://100.100.100.100:8080
3. It will now appear like a normal shared network drive on your computer.
You don’t need to actually use SSH keys to securely access your server. This is where Tailscale feels like magic 🪄Tailscale SSH allows Tailscale to do the heavy lifting by taking over incoming port 22 connections. It will then authenticate it and encrypt it using tailscale and node keys. Thus, allowing you to create an SSH connection.
Remember above when we advertised the VPS as an exit node? Let’s make a small change to that.
Notice we added -ssh to the command. This tells Tailscale we want to use Tailscale SSH and advertise the VPS as an exit node. Go ahead and execute that command.
-ssh
tailscale up --ssh --advertise-exit-node
--accept-risk=lose-ssh
sudo tailscale up --ssh --advertise-exit-node --accept-risk=lose-ssh
5. Hover your mouse toward the ellipses (…) and click the SSH button.
Now Tailscale will create another Tailnet node to secure SSH into your server from anywhere!
6. Click SSH and choose the user you’d like to sign in with, click SSH again.
Once you’re authenticated you’ll have your own browser-based SSH session accessible from anywhere! Don’t worry, once you’re finished with your remote shell session, Tailscale will destroy the temporary node you can see.
Congratulations! You’ve now built a secure, flexible, and private recon network using Tailscale. Not only have you streamlined your workflow, but you’ve also gained valuable skills applicable to both offensive and defensive security.
Remember, this is just the beginning. Tailscale offers many more features to explore, and the world of network security is constantly evolving. So, continue to experiment, learn, and adapt these tools to your unique needs.
I hope this guide has empowered you to take your bug bounty hunting and security practices to the next level. Feel free to share your experiences or ask any questions you may have.
Don’t stop here! Go check out the other LevelUp articles here: https://www.bugcrowd.com/resources/levelup/
If you want to continue the discussion, tweet at me, or connect with me on LinkedIn!
Thanks so much to the Bugcrowd team for allowing me to share 🧡
Happy hunting!