[GH-ISSUE #2315] FreeBSD MD5 password guesses are truncated to 15 characters #1548

Closed
opened 2026-10-15 04:19:47 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @nidem on GitHub (Oct 31, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2315

The FreeBSD MD5 format truncates password guesses to 15 characters, thereby making 16+ character passwords uncrackable.

Attempt with 16 character password (fails):

me@home:~$ PASSWORD=1234567890123456
me@home:~$ SALT=OS5yjsCr
me@home:~$ mkpasswd -m md5 $PASSWORD $SALT | tee hashtocrack
$1$OS5yjsCr$jPaWf.k9737Zk1Xvk4vqd0
me@home:~$ echo $PASSWORD > password
me@home:~$ john --wordlist=password hashtocrack 
Loaded 1 password hash (FreeBSD MD5 [128/128 SSE2 intrinsics 12x])
guesses: 0  time: 0:00:00:00 DONE (Mon Oct 31 10:31:39 2016)  c/s: 100  trying: 123456789012345

Attempt with 15 character password (success):

me@home:~$ PASSWORD=123456789012345
me@home:~$ SALT=OS5yjsCr
me@home:~$ mkpasswd -m md5 $PASSWORD $SALT | tee hashtocrack
$1$OS5yjsCr$dy1TcpXeCoxULwUeze00A/
me@home:~$ echo $PASSWORD > password
me@home:~$ john --wordlist=password hashtocrack 
Loaded 1 password hash (FreeBSD MD5 [128/128 SSE2 intrinsics 12x])
123456789012345  (?)
guesses: 1  time: 0:00:00:00 DONE (Mon Oct 31 10:31:46 2016)  c/s: 100  trying: 123456789012345
Use the "--show" option to display all of the cracked passwords reliably

In example 1, notice the trying: 123456789012345 when the initial password is 1234567890123456.

The problem seems to existed t for quiet a while: http://www.backtrack-linux.org/forums/showthread.php?t=33697

Originally created by @nidem on GitHub (Oct 31, 2016). Original GitHub issue: https://github.com/openwall/john/issues/2315 The FreeBSD MD5 format truncates password guesses to 15 characters, thereby making 16+ character passwords uncrackable. Attempt with 16 character password (fails): ``` me@home:~$ PASSWORD=1234567890123456 me@home:~$ SALT=OS5yjsCr me@home:~$ mkpasswd -m md5 $PASSWORD $SALT | tee hashtocrack $1$OS5yjsCr$jPaWf.k9737Zk1Xvk4vqd0 me@home:~$ echo $PASSWORD > password me@home:~$ john --wordlist=password hashtocrack Loaded 1 password hash (FreeBSD MD5 [128/128 SSE2 intrinsics 12x]) guesses: 0 time: 0:00:00:00 DONE (Mon Oct 31 10:31:39 2016) c/s: 100 trying: 123456789012345 ``` Attempt with 15 character password (success): ``` me@home:~$ PASSWORD=123456789012345 me@home:~$ SALT=OS5yjsCr me@home:~$ mkpasswd -m md5 $PASSWORD $SALT | tee hashtocrack $1$OS5yjsCr$dy1TcpXeCoxULwUeze00A/ me@home:~$ echo $PASSWORD > password me@home:~$ john --wordlist=password hashtocrack Loaded 1 password hash (FreeBSD MD5 [128/128 SSE2 intrinsics 12x]) 123456789012345 (?) guesses: 1 time: 0:00:00:00 DONE (Mon Oct 31 10:31:46 2016) c/s: 100 trying: 123456789012345 Use the "--show" option to display all of the cracked passwords reliably ``` In example 1, notice the `trying: 123456789012345` when the initial password is `1234567890123456`. The problem seems to existed t for quiet a while: http://www.backtrack-linux.org/forums/showthread.php?t=33697
bsakaguchi 2026-10-15 04:19:47 +07:00
  • closed this issue
  • added the
    invalid
    label
Author
Owner

@jfoug commented on GitHub (Oct 31, 2016):

This is not a bug. This is by design, and will not be changed. To crack these hashes with > 15 byte passwords use the --format=crypt (must be run on a system which the crypt system function can handle the MD5-crypt hash)

The md5-crypt hash is pretty complex. It cycles through 42 different concatenation methods to build each block of data to be hashed (it performs 1000 hashes I think, cycling through these 42 'types'). The 15 character limit is so that all data will fit into a single md5 'limb'. That means that all concatentated data for a single hashing must be 55 bytes or less. The only way to fit that is to keep the input password to 15 characters or less.

<!-- gh-comment-id:257335951 --> @jfoug commented on GitHub (Oct 31, 2016): This is not a bug. This is by design, and will not be changed. To crack these hashes with > 15 byte passwords use the --format=crypt (must be run on a system which the crypt system function can handle the MD5-crypt hash) The md5-crypt hash is pretty complex. It cycles through 42 different concatenation methods to build each block of data to be hashed (it performs 1000 hashes I think, cycling through these 42 'types'). The 15 character limit is so that all data will fit into a single md5 'limb'. That means that all concatentated data for a single hashing must be 55 bytes or less. The only way to fit that is to keep the input password to 15 characters or less.
Author
Owner

@ghost commented on GitHub (Oct 31, 2016):

This not a 'problem':

  • the md5crypt format can handle passwords up to 15 chars length;
  • you can use a workaround, the crypt format (some conditions may apply);
  • BTW: I guess you are using a very old version, the format was renamed a very long time ago;
  • below you can see your hash cracked:
$ ../run/john --wordlist=password hashtocrack --format=crypt
Using default input encoding: UTF-8
Loaded 1 password hash (crypt, generic crypt(3) [?/64])
Will run 6 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
1234567890123456 (?)
1g 0:00:00:00 DONE (2016-10-31 13:49) 4.347g/s 4.347p/s 4.347c/s 4.347C/s 1234567890123456
Use the "--show" option to display all of the cracked passwords reliably
Session completed
<!-- gh-comment-id:257336037 --> @ghost commented on GitHub (Oct 31, 2016): This not a 'problem': - the md5crypt format can handle passwords up to 15 chars length; - you can use a workaround, the crypt format (some conditions may apply); - BTW: I guess you are using a very old version, the format was renamed a very long time ago; - below you can see your hash cracked: ``` $ ../run/john --wordlist=password hashtocrack --format=crypt Using default input encoding: UTF-8 Loaded 1 password hash (crypt, generic crypt(3) [?/64]) Will run 6 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status 1234567890123456 (?) 1g 0:00:00:00 DONE (2016-10-31 13:49) 4.347g/s 4.347p/s 4.347c/s 4.347C/s 1234567890123456 Use the "--show" option to display all of the cracked passwords reliably Session completed ```
Author
Owner

@nidem commented on GitHub (Oct 31, 2016):

I've tried it on a bunch of versions. I posted an old version to show how long the "issue" has been around.

<!-- gh-comment-id:257336367 --> @nidem commented on GitHub (Oct 31, 2016): I've tried it on a bunch of versions. I posted an old version to show how long the "issue" has been around.
Author
Owner

@jfoug commented on GitHub (Oct 31, 2016):

Add --format=crypt and your hash will crack just fine. The crypt format is quite a bit slower. It simply uses the systems crypt library call. THUS you should not use this with any dictionary words < 15 characters. Run the md5-crypt builtin john format for those. But to test the > 15 byte passwords, you can use crypt.

<!-- gh-comment-id:257338538 --> @jfoug commented on GitHub (Oct 31, 2016): Add --format=crypt and your hash will crack just fine. The crypt format is quite a bit slower. It simply uses the systems crypt library call. THUS you should not use this with any dictionary words < 15 characters. Run the md5-crypt builtin john format for those. But to test the > 15 byte passwords, you can use crypt.
Author
Owner

@nidem commented on GitHub (Oct 31, 2016):

Thanks

<!-- gh-comment-id:257340365 --> @nidem commented on GitHub (Oct 31, 2016): Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#1548
No description provided.