Decrypting Cisco type 5 password hashes

Update #2: This article has been updated over at https://retrorabble.wordpress.com/2013/10/12/cracking-cisco-password-hashes-part-2/

UPDATE:  See bottom of post for a way to run MD5 cracking on Linux

Well, I managed to find this information out by phoning Cisco directly, and since most of the information on this subject seems to be either plain wrong or incomprehensible rubbish spouted by people with no idea what checking up on facts or cross referencing is, I’ve decided to share my knowledge here:

Cisco type 5 passwords are based on FREEBSD’s MD5 function with a SALT included to make life harder; however, as a typical type 5 password also includes the SALT, it does tend to defeat the purpose of SALTing values.  For example:

enable secret 5 $1$mERr$hx5rVt7rPNoS4wqbXKX7m0

Let’s break that down:

enable secret 5     This tells us that the password is an MD5 SALTed password.

$1$     Tells us that yes, it really is a SALTed MD5 password

mERr     This is our SALT.  From here, we can use a program to crack the MD5 hash  I have used http://www.darknet.org.uk/2009/07/crack-pl-sha1-md5-hash-cracking-tool/

hx5rVt7rPNoS4wqbXKX7m0     And this is our MD5 hash

PS: I found that password hash using the Googledork: inurl:startup-config “enable secret 5”

Update: After some discussion with another member of my local LUG, we managed to get BarsWF MD5 (http://3.14.by/en/md5) cracker running under Wine.  This is a 3 stage process

1.) Grab a copy of BarsWF (if you have CUDA, yuo will need to run it under Windows, unless you want to port it to Linux.  I couldn’t get the 64 bit binary running under Wine, so ran with the x86 edition.

2.) You need a cisco type 5 password hash, of course, you already own a cisco device and have generated a SALTed MD5 hash for educational purposes, right..?  Let’s assume mine is hx5rVt7rPNoS4wqbXKX7m0

Next, we have to convert the password string into a base64 encoded string.  I use http://www.motobit.com/util/base64-decoder-encoder.asp But had to change the character set to windows-1250 which gave me the string aHg1clZ0N3JQTm9TNHdxYlhLWDdtMA== now, we can attempt a brute force on it.

3.) Now, all we need to do is force the issue:

retrorabble@Lisa[~]$ BarsWF_SSE2_x32.exe -c 0aA~ -h aHg1clZ0N3JQTm9TNHdxYlhLWDdtMA==

4.) If you are on Linux and use CUDA (or whatever ATI calls it) have a look at http://www.networkworld.com/community/node/43721 or if you realy want to push the envelope: http://hashcat.net/hashcat/ expect hashcat to feature in a future posting as it seems to be what I am looking for (i.e. a multi-threaded, multi core, non GPU, bruteforcer for salted MD5 passwords).

I will update this post as and when new information is added.

6 Responses to Decrypting Cisco type 5 password hashes

  1. 130513041501 says:

    Gday! I am about to begin my own blog and was wondering if you know where the best place to purchase a blog url is?
    I am not even sure if that’s what its called? (I’m new to this) I’m referring to “https://retrorabble.wordpress.com/2011/02/09/decrypting-cisco-type-5-password-hashes/”. How do I go about obtaining one of these for the website I’m building?
    Thank you

    • retrorabble says:

      Hi,

      I registered an account at wordpress.com and they asked me to pick a URL. It auto generates my page names based on the title URL. As far as I know all of this is included. I certainly didn’t purchase any URLS or such.

      Thanks.

  2. Jorge (Spain says:

    Hi, what about if a wanted to do it on Windows, Do I have to convert the password string into a base64 encoded string?
    I,m trying but is not working at all.
    Thanks in advanced for your help and support

    • retrorabble says:

      Hi,

      You would still require the base64 decoding as that is the format BarsWF wants. You might want to check out the Rainbow Tables project or perhaps invest in a CUDA aware Graphics card to do this stuff. I have done this and it is much easier and better.

  3. cracked says:

    has anyone got this to work as shown above? seems like you should have to feed the SALT to BarsWF in order for this to work.

  4. Pingback: Cracking Cisco Password Hashes Part 2 | retrorabble

Leave a comment