Decrypting Cisco type 5 password hashes

Source: Internet
Author: User
Tags md5 hash

Update #2: This article has been updated over at http://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 got decided to share my knowledge here:

Cisco type 5 passwords are based on FREEBSD's MD5 function with a SALT encoded ded to make life harder; however, as a typical type 5 password also encoded des 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 usedHttp://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.aspBut had to change the character set Windows-1250Which 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:

Export rabble @ Lisa [~] $ BarsWF_SSE2_x32.exe-c 0aA ~ -H aHg1clZ0N3JQTm9TNHdxYlhLWDdtMA =

4.) If you are on Linux and use CUDA (or whatever ATI callit) have a look Http://www.networkworld.com/community/node/43721Or if you realy want to push the envelope: Http://hashcat.net/hashcat/Keep CT 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 ).

 

Some time ago, I wrote a blog post about cracking Cisco type 5 passwords. This seems to have generated quite a fuss online, and is referenced by your security blogs and other commentators.

Well, it's now 2013, and GPU graphics cards can be bought for as little as £25 in town. so I have now splashed out on an Nvidia GeForce 210 with 1024 MB RAM. if you are really serous about cracking passwords with CUDA, I wocould suggest trying to stretch the budget to 2 cards. I went for an AGP card, but will be adding a PCI card soon.

Once you have installed the card physically, the next part is making the drivers work correctly. I am currently using a server which has some X11 libraries installed, but boots into runlevel 3 as it is a server.

Installing the card:

knightmare@vmserver:[~/cuda]$ chmod +x ./NVIDIA-Linux-x86_64-319.17.run
knightmare@vmserver:[~/cuda]$ sudo apt-get remove --purge nvidia*
knightmare@vmserver:[~/cuda]$ sudo reboot -n
knightmare@vmserver:[~/cuda]$ sudo ./NVIDIA-Linux-x86_64-319.17.run

This may need to be re-run on a kernel upgrade. So keep the installer around to be on the safe side.

Using it:

For testing purposes, I decided to use openssl to generate a password:

knightmare@vmserver:[~/cuda]$ wget http://hashcat.net/files/oclHashcat-plus-0.15.7z
knightmare@vmserver:[~/cuda]$ 7za x http://hashcat.net/files/oclHashcat-plus-0.15.7z
knightmare@vmserver:[~/cuda]$ openssl passwd -salt `openssl rand -base64 3` -1 "Cisco" | tee switch.txt
knightmare@vmserver:[~/cuda]$ ./cudaHashcat-plus64.bin -a 3 -m 500 --increment --increment-min=5 --increment-max=5 switch.txt -1 ?l?d?u ?1?1?1?1?1?1?1?1?1?1 --force

cudaHashcat-plus v0.15 by atom starting...

Hashes: 1 total, 1 unique salts, 1 unique digests
Bitmaps: 8 bits, 256 entries, 0x000000ff mask, 1024 bytes
Workload: 64 loops, 80 accel
Watchdog: Temperature abort trigger set to 90c
Watchdog: Temperature retain trigger set to 80c
Device #1: GeForce 210, 1023MB, 1238Mhz, 2MCU
Device #1: Kernel ./kernels/4318/m0500.sm_12.64.ptx
Device #1: Kernel ./kernels/4318/markov_le_plus_v1.64.ptx
Device #1: Kernel ./kernels/4318/bzero.64.ptx

$1$iIE+$n4xAbruNLv1rGue/ONSPH.:Cisco

Session.Name...: cudaHashcat-plus
Status.........: Cracked
Input.Mode.....: Mask (?1?1?1?1?1) [5]
Hash.Target....: $1$iIE+$n4xAbruNLv1rGue/ONSPH.
Hash.Type......: md5crypt, MD5(Unix), FreeBSD MD5, Cisco-IOS MD5
Time.Started...: Sat Oct 12 11:10:00 2013 (9 mins, 43 secs)
Speed.GPU.#1...: 28208 H/s
Recovered......: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts
Progress.......: 16465920/916132832 (1.80%)
Rejected.......: 0/16465920 (0.00%)
HWMon.GPU.#1...: -1% Util, 67c Temp, -1% Fan

Started: Sat Oct 12 11:10:00 2013
Stopped: Sat Oct 12 11:19:43 2013

As you can see, a single CPU can make short work of a 5 character password. in my experience, most password are less than 8 characters are usually lowercase. although, this is a minor point as CUDA can use a mask attack to guess almost any password within a 7 day time frame.

Given that most initialize ate it policies require a password change every 30 days, this still gives a minimum of 22 days for a hacker's window of opportunity. Passwords shoshould always be considered One Line of defense, not Only Line of defense.

Updated: 13 October 2013 

I 've ve now added a second Ge-Froce 210 to the mix. Running the same command gives me:

knightmare@vmserver:[~/cuda]$ ./cudaHashcat-plus64.bin -a 3 -m 500 --increment --increment-min=5 --increment-max=5 switch.txt -1 ?l?d?u ?1?1?1?1?1?1?1?1?1?1 --force
cudaHashcat-plus v0.15 by atom starting...

Hashes: 1 total, 1 unique salts, 1 unique digests
Bitmaps: 8 bits, 256 entries, 0x000000ff mask, 1024 bytes
Workload: 64 loops, 80 accel
Watchdog: Temperature abort trigger set to 90c
Watchdog: Temperature retain trigger set to 80c
Device #1: GeForce 210, 1023MB, 1238Mhz, 2MCU
Device #2: GeForce 210, 1023MB, 1238Mhz, 2MCU
Device #1: Kernel ./kernels/4318/m0500.sm_12.64.ptx
Device #1: Kernel ./kernels/4318/markov_le_plus_v1.64.ptx
Device #1: Kernel ./kernels/4318/bzero.64.ptx
Device #2: Kernel ./kernels/4318/m0500.sm_12.64.ptx
Device #2: Kernel ./kernels/4318/markov_le_plus_v1.64.ptx
Device #2: Kernel ./kernels/4318/bzero.64.ptx

[s]tatus [p]ause [r]esume [b]ypass [q]uit =>
$1$fzXQ$mcngG/JU0gHZAWGKTbJfZ0:cisco

Session.Name...: cudaHashcat-plus
Status.........: Cracked
Input.Mode.....: Mask (?1?1?1?1?1) [5]
Hash.Target....: $1$fzXQ$mcngG/JU0gHZAWGKTbJfZ0
Hash.Type......: md5crypt, MD5(Unix), FreeBSD MD5, Cisco-IOS MD5
Time.Started...: Sun Oct 13 14:54:09 2013 (4 mins, 59 secs)
Speed.GPU.#1...:    28275 H/s
Speed.GPU.#2...:    28061 H/s
Speed.GPU.#*...:    56336 H/s
Recovered......: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts
Progress.......: 16465920/916132832 (1.80%)
Rejected.......: 0/16465920 (0.00%)
HWMon.GPU.#1...: -1% Util, 62c Temp, -1% Fan
HWMon.GPU.#2...: -1% Util, 54c Temp, -1% Fan

Started: Sun Oct 13 14:54:09 2013
Stopped: Sun Oct 13 14:59:13 2013
knightmare@vmserver:[~/cuda]$

This was achived for approx £50 and by purchasing two low end NVidia cards from my local Computer shop. if you are really serious about this sort of thing, it pays to get a server and buy some fancier CUDA aware graphics cards


Alibaba Cloud Hot Products

Elastic Compute Service (ECS) Dedicated Host (DDH) ApsaraDB RDS for MySQL (RDS) ApsaraDB for PolarDB(PolarDB) AnalyticDB for PostgreSQL (ADB for PG)
AnalyticDB for MySQL(ADB for MySQL) Data Transmission Service (DTS) Server Load Balancer (SLB) Global Accelerator (GA) Cloud Enterprise Network (CEN)
Object Storage Service (OSS) Content Delivery Network (CDN) Short Message Service (SMS) Container Service for Kubernetes (ACK) Data Lake Analytics (DLA)

ApsaraDB for Redis (Redis)

ApsaraDB for MongoDB (MongoDB) NAT Gateway VPN Gateway Cloud Firewall
Anti-DDoS Web Application Firewall (WAF) Log Service DataWorks MaxCompute
Elastic MapReduce (EMR) Elasticsearch

Alibaba Cloud Free Trail

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.