Building a Threat Hunting Lab (Part2): The DNS Server and Logs
Setting up the DNS Server
This blog is going to be a bit shorter than some of the later blogs in this series but thanks to the hard work of the team behind PiHole this job VM was actually extremely easy to do.
Pihole is an extremely efficient and DNS based adblocking server that has a minimal footprint. Since it'd designed to run on a Raspberry Pi 3 the requirements to run it are tiny. The DNS server I'm using for this is an Ubuntu 17.10 headless server with 1 Core and 512MB of ram.
Why PiHole?
I chose Pihole for 2 big reasons. First I love Pihole. I have 2 of them, one that I run on a Raspberry Pi 3 and 1 that I run on a Digital Ocean VPS for friends and family.
The other big reason I chose to use Pihole is because it does 90% of the set up for me and created a web interface that analysts can use to check through network logs. The web interface is the most crucial part of why I chose Pihole. There's no need to over complicate threat hunting if you don't need to.
Installation
Again the team behind Pihole deserve tons of credit for making this process so simple. 1 Command was enough to get 90% of this VM configured.
curl -sSL https://install.pi-hole.net | bashThis command will run through an automated installer where you can assign the network for the Pihole to monitor. The Pihole will assume you want to run it for the /24 of whatever network your on. For me this was 10.0.2.1/24 but you can configure this to your linking. If you ever need to change the Pihole monitoring its a simple command.
pihole -rThat one command will allow you to rerun the installer and reconfigure the IP address in case you move it like it did form the NAT network to a Host Only network.
After the Pihole finished installing I wanted to modify it's log file to add in malicious connections. I wasn't actually planning on connecting my Win 7 VM to the malicious domains but I needed logs that made it seem like I did.
sudo nano /var/log/pihole.logAfter that it just became a simple but manual process of adding logs to the file. I won't bore you all of the random stuff I entered but I added in this nugget:
Nov 19 07:28:53 dnsmasq[1045]: query[A] www.badguy.com from 10.0.2.7
Nov 19 07:28:53 dnsmasq[1045]: reply www.badguy.com is 10.0.2.4I actually have an apache webserver running a domain called www.badguy.com with the IP of 10.0.2.4
Now that I have a DNS server running with a "malicious" IOC in it's log file it's time to place that server in deepfreeze (suspend the VM) and move on.
Be sure to check out part 3 where I create and configure the Apache website to be www.badguy.com.
Comments
Post a Comment