New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cisco-ASA MD5 increase max Password #1488

Closed
SilRo991 opened this Issue Jan 8, 2018 · 8 comments

Comments

Projects
None yet
4 participants
@SilRo991

SilRo991 commented Jan 8, 2018

Hi,

I have to open a new case, because my previous one #1478 was closed.

if I use -m 2410 I get the following warning:

./OpenCL/m02410_a3-optimized.cl: Pure OpenCL kernel not found, falling back to optimized OpenCL kernel
Skipping mask 'hashca?l?d?d?d?d?d?d' because it is larger than the maximum password length.

I Used the example Hash: hashcat64.exe -m 2410 -a 3 02dMBMYkTdC5Ziyp:36 hashca?l?d?d?d?d?d?d

Is it possible to get a information on what is the max password length?
And can you increase the max password?

In my older Post the reason was, that it makes no sense to increase it because it does not support passwords longer 12.

From the help of an ASA Device I have this Information: Enter a password between 3 and 127 characters.

You can also find this online:
Sets the password as a string from 3 to 32 characters in length (9.5 and earlier) or 127 characters (9.6 and later), which can be any combination of ASCII printable characters (character codes 32-126), with the exception of spaces and the question mark.
https://www.cisco.com/c/en/us/td/docs/security/asa/asa-command-reference/T-Z/cmdref4/u.html

@jsteube

This comment has been minimized.

Show comment
Hide comment
@jsteube

jsteube Jan 10, 2018

Member

The problem is that the algorithm puts in a fixed 0x80 byte at position 16. If the password (including the salt) is longer than 16, then I'm not exactly sure how to handle that.

@magnumripper Any Idea? I see JtR is limiting to lenght 16 as well

Member

jsteube commented Jan 10, 2018

The problem is that the algorithm puts in a fixed 0x80 byte at position 16. If the password (including the salt) is longer than 16, then I'm not exactly sure how to handle that.

@magnumripper Any Idea? I see JtR is limiting to lenght 16 as well

@roycewilliams

This comment has been minimized.

Show comment
Hide comment
@roycewilliams

roycewilliams Jan 10, 2018

Contributor

Looks like OS versions below 9.7 support 32 characters or less?

https://www.cisco.com/c/en/us/td/docs/security/asa/asa97/release/notes/asarn97.html
(search for "32 char")

Trying to find a volunteer to help me verify on a live system.

It's possible that the length 16 was extended some time even earlier than the predecessors of 9.7. According to this page (but references a dead link), in OS version 7.0, the maximum was increased from 16 to 32:

https://github.com/stekershaw/asa-password-encrypt

Wayback Machine copy of "Cisco ASA 5500 Series Release Notes, Version 7.0(5)" at https://web.archive.org/web/20140215184559/https://www.cisco.com/c/en/us/td/docs/security/asa/asa70/release/notes/asarn705.html says:

"Username and enable password length limits increased from 16 to 32 in the LOCAL database"

Contributor

roycewilliams commented Jan 10, 2018

Looks like OS versions below 9.7 support 32 characters or less?

https://www.cisco.com/c/en/us/td/docs/security/asa/asa97/release/notes/asarn97.html
(search for "32 char")

Trying to find a volunteer to help me verify on a live system.

It's possible that the length 16 was extended some time even earlier than the predecessors of 9.7. According to this page (but references a dead link), in OS version 7.0, the maximum was increased from 16 to 32:

https://github.com/stekershaw/asa-password-encrypt

Wayback Machine copy of "Cisco ASA 5500 Series Release Notes, Version 7.0(5)" at https://web.archive.org/web/20140215184559/https://www.cisco.com/c/en/us/td/docs/security/asa/asa70/release/notes/asarn705.html says:

"Username and enable password length limits increased from 16 to 32 in the LOCAL database"

@magnumripper

This comment has been minimized.

Show comment
Hide comment
@magnumripper

magnumripper Jan 10, 2018

Contributor

The problem is that the algorithm puts in a fixed 0x80 byte at position 16. If the password (including the salt) is longer than 16, then I'm not exactly sure how to handle that.
@magnumripper Any Idea? I see JtR is limiting to lenght 16 as well

Yeah it was 16 at the time we got the first version of our format. I guess we need to bump it in JtR too.

So, we'll need some samples with known plain, to determine how to terminate the longer passwords. Perhaps it's set at minimum pos 16 (with nulls or spaces as padding? Can't remember but easy to check source) but then follows normal termination? That would be backwards compatible. But there's no point in guessing - we need samples!

Contributor

magnumripper commented Jan 10, 2018

The problem is that the algorithm puts in a fixed 0x80 byte at position 16. If the password (including the salt) is longer than 16, then I'm not exactly sure how to handle that.
@magnumripper Any Idea? I see JtR is limiting to lenght 16 as well

Yeah it was 16 at the time we got the first version of our format. I guess we need to bump it in JtR too.

So, we'll need some samples with known plain, to determine how to terminate the longer passwords. Perhaps it's set at minimum pos 16 (with nulls or spaces as padding? Can't remember but easy to check source) but then follows normal termination? That would be backwards compatible. But there's no point in guessing - we need samples!

@roycewilliams

This comment has been minimized.

Show comment
Hide comment
@roycewilliams

roycewilliams Jan 10, 2018

Contributor

Some kind colleagues generated examples for us.

Here's OS version 9.4(1), with plaintext lengths 8, 16, and 20:

ciscoasa# show ver
Cisco Adaptive Security Appliance Software Version 9.4(1)
Device Manager Version 7.4(1)
 Compiled on Sat 21-Mar-15 11:42 PDT by builders
System image file is "disk0:/asa941-lfbff-k8.SPA"

ciscoasa(config)# username admin password password
ciscoasa(config)# end
ciscoasa# show run | inc username admin
username admin password 7KKG/zg/Wo8c.YfN encrypted

ciscoasa(config)# username admin password hashcathashcat16
ciscoasa(config)# end
ciscoasa# show run | inc username
username admin password rC/YIoOgE2yy.A5Y encrypted

ciscoasa(config)# username admin password hashcathashcat16plus
ciscoasa(config)# end
ciscoasa# show run | inc username
username admin password UpSYutRKBYRFhl20 encrypted

And here's OS version 7.0(8):

E.clJuqSbkeIrm25 ("hashcathashcat16")
bnDHWJMbxGxyp4o3 ("hashcathashcat16plus")
Contributor

roycewilliams commented Jan 10, 2018

Some kind colleagues generated examples for us.

Here's OS version 9.4(1), with plaintext lengths 8, 16, and 20:

ciscoasa# show ver
Cisco Adaptive Security Appliance Software Version 9.4(1)
Device Manager Version 7.4(1)
 Compiled on Sat 21-Mar-15 11:42 PDT by builders
System image file is "disk0:/asa941-lfbff-k8.SPA"

ciscoasa(config)# username admin password password
ciscoasa(config)# end
ciscoasa# show run | inc username admin
username admin password 7KKG/zg/Wo8c.YfN encrypted

ciscoasa(config)# username admin password hashcathashcat16
ciscoasa(config)# end
ciscoasa# show run | inc username
username admin password rC/YIoOgE2yy.A5Y encrypted

ciscoasa(config)# username admin password hashcathashcat16plus
ciscoasa(config)# end
ciscoasa# show run | inc username
username admin password UpSYutRKBYRFhl20 encrypted

And here's OS version 7.0(8):

E.clJuqSbkeIrm25 ("hashcathashcat16")
bnDHWJMbxGxyp4o3 ("hashcathashcat16plus")
@jsteube

This comment has been minimized.

Show comment
Hide comment
@jsteube

jsteube Jan 15, 2018

Member

Wondering what's the salt then. Is it "admi" instead of "admin" ?

Member

jsteube commented Jan 15, 2018

Wondering what's the salt then. Is it "admi" instead of "admin" ?

@SilRo991

This comment has been minimized.

Show comment
Hide comment
@SilRo991

SilRo991 Jan 15, 2018

Yes. It use the first 4 char from the username.

SilRo991 commented Jan 15, 2018

Yes. It use the first 4 char from the username.

@SilRo991

This comment has been minimized.

Show comment
Hide comment
@SilRo991

SilRo991 Jan 15, 2018

I can paste some examples too:
Cisco Adaptive Security Appliance Software Version 9.1(7)16

Plain passwords:

username admin1 password 12345678901234
username admin2 password 12345678
username admin3 password 1234567890123456
username admin4 password 123456789012345678
username admin5 password 12345678
username admin6 password 123456789012

username a password 12345678
Minimum allowed username length is 3
ERROR: Username addition failed.

username adm password 12345678
username admi password 12345678
username admin password 12345678

Hashed:

username admin1 password jPvB8dZSJc584qfl encrypted
username admin2 password YE2FV.4x2hjEDjup encrypted
username admin3 password Yx2nrL7o8myDPoI5 encrypted
username admin4 password Sep8sPNoTRHoSn7w encrypted
username admin5 password YE2FV.4x2hjEDjup encrypted
username admin6 password FAjQWHbLfs8.R717 encrypted

username adm password yBEOBp9AO4K.3mYs encrypted
username admi password YE2FV.4x2hjEDjup encrypted
username admin password YE2FV.4x2hjEDjup encrypted

SilRo991 commented Jan 15, 2018

I can paste some examples too:
Cisco Adaptive Security Appliance Software Version 9.1(7)16

Plain passwords:

username admin1 password 12345678901234
username admin2 password 12345678
username admin3 password 1234567890123456
username admin4 password 123456789012345678
username admin5 password 12345678
username admin6 password 123456789012

username a password 12345678
Minimum allowed username length is 3
ERROR: Username addition failed.

username adm password 12345678
username admi password 12345678
username admin password 12345678

Hashed:

username admin1 password jPvB8dZSJc584qfl encrypted
username admin2 password YE2FV.4x2hjEDjup encrypted
username admin3 password Yx2nrL7o8myDPoI5 encrypted
username admin4 password Sep8sPNoTRHoSn7w encrypted
username admin5 password YE2FV.4x2hjEDjup encrypted
username admin6 password FAjQWHbLfs8.R717 encrypted

username adm password yBEOBp9AO4K.3mYs encrypted
username admi password YE2FV.4x2hjEDjup encrypted
username admin password YE2FV.4x2hjEDjup encrypted

@jsteube

This comment has been minimized.

Show comment
Hide comment
@jsteube

jsteube Jan 27, 2018

Member

I was lucky to find the change to the algorithm in order to crack passwords > 16. One simply needs to pad with zero bytes to a next segment of 16 bytes.

@SilRo991 Thanks for the example hashes, that helped. If you want to play with it, clone latest hashcat version from github and build from source or use the binary beta from https://hashcat.net/beta/ to crack them.

@magnumripper The change required is explained best way here: e877c30#diff-7687bc127baaaa448c5fc5e56f0c2133L5571

Member

jsteube commented Jan 27, 2018

I was lucky to find the change to the algorithm in order to crack passwords > 16. One simply needs to pad with zero bytes to a next segment of 16 bytes.

@SilRo991 Thanks for the example hashes, that helped. If you want to play with it, clone latest hashcat version from github and build from source or use the binary beta from https://hashcat.net/beta/ to crack them.

@magnumripper The change required is explained best way here: e877c30#diff-7687bc127baaaa448c5fc5e56f0c2133L5571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment