[GH-ISSUE #370] add support for Atlassian’s PBKDF2-based hashes #107

Closed
opened 2026-10-14 02:53:05 +07:00 by bsakaguchi · 13 comments
Owner

Originally created by @kholia on GitHub (Aug 27, 2013).
Original GitHub issue: https://github.com/openwall/john/issues/370

See http://pythonhosted.org/passlib/lib/passlib.hash.atlassian_pbkdf2_sha1.html

Originally created by @kholia on GitHub (Aug 27, 2013). Original GitHub issue: https://github.com/openwall/john/issues/370 See http://pythonhosted.org/passlib/lib/passlib.hash.atlassian_pbkdf2_sha1.html
bsakaguchi 2026-10-14 02:53:05 +07:00
Author
Owner

@kholia commented on GitHub (Nov 16, 2013):

Also support http://pythonhosted.org/passlib/lib/passlib.hash.cta_pbkdf2_sha1.html while at it.

<!-- gh-comment-id:28622418 --> @kholia commented on GitHub (Nov 16, 2013): Also support http://pythonhosted.org/passlib/lib/passlib.hash.cta_pbkdf2_sha1.html while at it.
Author
Owner

@kholia commented on GitHub (Nov 16, 2013):

See https://github.com/magnumripper/JohnTheRipper/pull/408 for some sample code.

<!-- gh-comment-id:28630761 --> @kholia commented on GitHub (Nov 16, 2013): See https://github.com/magnumripper/JohnTheRipper/pull/408 for some sample code.
Author
Owner

@kholia commented on GitHub (Nov 19, 2014):

@jfoug is this something you would be interested in?

<!-- gh-comment-id:63619753 --> @kholia commented on GitHub (Nov 19, 2014): @jfoug is this something you would be interested in?
Author
Owner

@jfoug commented on GitHub (Nov 20, 2014):

I can tackle these. pretty trivial. atlassin forces utf8. I am going to add a flag to the salt, along with doing a prepare.

NOTE to @magnumripper is doing these conversions in prepare the CORRECT place to put them? Should they be in prepare, or in split? What are the nuances and differences? I have done a couple of these and no one has complained, but I doubt they are getting much use yet. I have only jammed this conversions into prepare currently.

I will tackle atalasssin, pull #408, etc.

<!-- gh-comment-id:63747294 --> @jfoug commented on GitHub (Nov 20, 2014): I can tackle these. pretty trivial. atlassin forces utf8. I am going to add a flag to the salt, along with doing a prepare. NOTE to @magnumripper is doing these conversions in prepare the CORRECT place to put them? Should they be in prepare, or in split? What are the nuances and differences? I have done a couple of these and no one has complained, but I doubt they are getting much use yet. I have only jammed this conversions into prepare currently. I will tackle atalasssin, pull #408, etc.
Author
Owner

@jfoug commented on GitHub (Nov 20, 2014):

atlassian:

if (!strncmp(fields[1], PKCS5S2_TAG, 9)) {
        char tmp[120];
        if (strlen(fields[1]) > 75) return fields[1];
        //{"{PKCS5S2}DQIXJU038u4P7FdsuFTY/+35bm41kfjZa57UrdxHp2Mu3qF2uy+ooD+jF5t1tb8J", "password"},
        //{"$pbkdf2-hmac-sha1$10000.0d0217254d37f2ee0fec576cb854d8ff.edf96e6e3591f8d96b9ed4addc47a7632edea176bb2fa8a03fa3179b75b5bf09", "password"},
        base64_convert(&(fields[1][9]), e_b64_mime, strlen(&(fields[1][9])), tmp, e_b64_hex, sizeof(tmp), 0);
        sprintf(Buf, "$pbkdf2-hmac-sha1$10000.%32.32s.%s", tmp, &tmp[32]);
        return Buf;
    }

That's why I thought getting a base-64 conv was going to be so helpful. Tiny format change, 20 minutes to insert. Yes, I still have to find some way to inform the format that this one requires utf8 password, but that should not take much. I might use case of one character in the pbkdf2-hmac-sha1 signature, and use strcasecmp

<!-- gh-comment-id:63749121 --> @jfoug commented on GitHub (Nov 20, 2014): atlassian: ``` C if (!strncmp(fields[1], PKCS5S2_TAG, 9)) { char tmp[120]; if (strlen(fields[1]) > 75) return fields[1]; //{"{PKCS5S2}DQIXJU038u4P7FdsuFTY/+35bm41kfjZa57UrdxHp2Mu3qF2uy+ooD+jF5t1tb8J", "password"}, //{"$pbkdf2-hmac-sha1$10000.0d0217254d37f2ee0fec576cb854d8ff.edf96e6e3591f8d96b9ed4addc47a7632edea176bb2fa8a03fa3179b75b5bf09", "password"}, base64_convert(&(fields[1][9]), e_b64_mime, strlen(&(fields[1][9])), tmp, e_b64_hex, sizeof(tmp), 0); sprintf(Buf, "$pbkdf2-hmac-sha1$10000.%32.32s.%s", tmp, &tmp[32]); return Buf; } ``` That's why I thought getting a base-64 conv was going to be so helpful. Tiny format change, 20 minutes to insert. Yes, I still have to find some way to inform the format that this one requires utf8 password, but that should not take much. I might use case of one character in the $pbkdf2-hmac-sha1$ signature, and use strcasecmp
Author
Owner

@magnumripper commented on GitHub (Nov 20, 2014):

Should they be in prepare, or in split? What are the nuances and differences?

http://www.openwall.com/lists/john-dev/2014/06/24/1
http://www.openwall.com/lists/john-dev/2011/07/06/8

Some key differences (apart from the fact prepare() is the only one function that can see other input file fields than "ciphertext"):

  • pot file lines doesn't go through prepare(). Among other things, this means if you add a tag to bare hashes in prepare(), untagged hashes from a pot file will not be recognized.
  • if things are converted in prepare(), valid() only needs to accept the canonical format.
  • If things are converted in split(), valid() needs to accept both/all formats
<!-- gh-comment-id:63750532 --> @magnumripper commented on GitHub (Nov 20, 2014): > Should they be in prepare, or in split? What are the nuances and differences? http://www.openwall.com/lists/john-dev/2014/06/24/1 http://www.openwall.com/lists/john-dev/2011/07/06/8 Some key differences (apart from the fact prepare() is the only one function that can see other input file fields than "ciphertext"): - pot file lines doesn't go through prepare(). Among other things, this means if you add a tag to bare hashes in prepare(), untagged hashes from a pot file will not be recognized. - if things are converted in prepare(), valid() only needs to accept the canonical format. - If things are converted in split(), valid() needs to accept both/all formats
Author
Owner

@magnumripper commented on GitHub (Nov 20, 2014):

Executive summary: I'm not 100% sure but I think unifying case and adding tags should happen in split() while other conversions - like this one - should happen in prepare(). NT converts from pwdump format in prepare() but still uses split() to unify case and add a tag. This means NT's valid() does not need to care about pwdump format but it has to accept untagged/tagged as well as lower/upper case.

<!-- gh-comment-id:63751431 --> @magnumripper commented on GitHub (Nov 20, 2014): Executive summary: I'm not 100% sure but I think unifying case and adding tags should happen in split() while other conversions - like this one - should happen in prepare(). NT converts from pwdump format in prepare() but still uses split() to unify case and add a tag. This means NT's valid() does not need to care about pwdump format but it has to accept untagged/tagged as well as lower/upper case.
Author
Owner

@jfoug commented on GitHub (Nov 20, 2014):

We do not handle anything other than canonical format in valid. The original hash is 'lost' (whihc I do not like), and never stored in .pot. So prepare is adequate. -show does find the hashes just fine, But hand looking through .pot (and there are auto tools that strip out cracks from input files), will never find the hashes. But it is a LOT more work to have same code in valid, as in split (but I guess valid 'could' simply call split.

I will do it in whatever way you think is best. Current method is prepare, that smashes original hash into a canonical format. i do like the simplicity, but do not like losing the hash string.

<!-- gh-comment-id:63753090 --> @jfoug commented on GitHub (Nov 20, 2014): We do not handle anything other than canonical format in valid. The original hash is 'lost' (whihc I do not like), and never stored in .pot. So prepare is adequate. -show does find the hashes just fine, But hand looking through .pot (and there are auto tools that strip out cracks from input files), will never find the hashes. But it is a LOT more work to have same code in valid, as in split (but I guess valid 'could' simply call split. I will do it in whatever way you think is best. Current method is prepare, that smashes original hash into a canonical format. i do like the simplicity, but do not like losing the hash string.
Author
Owner

@jfoug commented on GitHub (Nov 20, 2014):

p5k2 getting closer. Was a bit more work, because I added a new alphabet into the convert (mime with +==- and /==_)

<!-- gh-comment-id:63753169 --> @jfoug commented on GitHub (Nov 20, 2014): $p5k2$ getting closer. Was a bit more work, because I added a new alphabet into the convert (mime with +==- and /==_)
Author
Owner

@jfoug commented on GitHub (Nov 20, 2014):

3503dda adds to pbkdf2-hmac-sha1_fmt.c

e52d74c fixed some base64 to hex issues, and added the -_ mime alphabet.

cdec50c adds ground work for the utf8 passwords (if stuff is in unicode). I have not made changes to actually DO the utf8 convert. I sort of punted to magnum ;) We should probably have a utf8 password test hash generated also.

NOTE, the 2 patches to the pbkdf2-hmac-sha1 format should also be done to opencl version (that has not been done yet).

<!-- gh-comment-id:63755485 --> @jfoug commented on GitHub (Nov 20, 2014): 3503dda adds to pbkdf2-hmac-sha1_fmt.c e52d74c fixed some base64 to hex issues, and added the -_ mime alphabet. cdec50c adds ground work for the utf8 passwords (if stuff is in unicode). I have not made changes to actually DO the utf8 convert. I sort of punted to magnum ;) We should probably have a utf8 password test hash generated also. NOTE, the 2 patches to the pbkdf2-hmac-sha1 format should also be done to opencl version (that has not been done yet).
Author
Owner

@jfoug commented on GitHub (Nov 20, 2014):

Added to opencl 4d85566 I am going to close this one, even though cdec50c is still in flux.

<!-- gh-comment-id:63804359 --> @jfoug commented on GitHub (Nov 20, 2014): Added to opencl 4d85566 I am going to close this one, even though cdec50c is still in flux.
Author
Owner

@jfoug commented on GitHub (Nov 20, 2014):

@kholia , @magnumripper if there are other hashes where we have multiple types and some we do not support, let me know. adding support is much easier, now with simple with a single function to do the encoding conversion.

<!-- gh-comment-id:63804602 --> @jfoug commented on GitHub (Nov 20, 2014): @kholia , @magnumripper if there are other hashes where we have multiple types and some we do not support, let me know. adding support is much easier, now with simple with a single function to do the encoding conversion.
Author
Owner

@magnumripper commented on GitHub (Nov 20, 2014):

Another track is to write out all --list=format-tests and look for hex ones that are humongous. Change them to Base64! I think the very worst offender was Luks but it was partially fixed.

<!-- gh-comment-id:63895609 --> @magnumripper commented on GitHub (Nov 20, 2014): Another track is to write out all `--list=format-tests` and look for hex ones that are humongous. Change them to Base64! I think the very worst offender was Luks but it was partially fixed.
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#107
No description provided.