mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2624] SSH-ng doesn't correctly handle non-default iteration count for bcrypt_pbkdf #1710
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#1710
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Apingis on GitHub (Jul 10, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2624
Originally assigned to: @kholia on GitHub.
sshng2john.py doesn't correctly handle non-default iteration count for keys encrypted with bcrypt_pbkdf (created with
ssh-keygen -o)It always stores the default iteration count.
If iteration count in password file is edited, then john can't load the hash:
It's not clear if bcrypt_pbkdf can emit false positives - even if it can then the probability must be extremely low. The message on false positives seems to be related to other algorithm handled by the same format.
@kholia commented on GitHub (Jul 11, 2017):
I think there are multiple problems with cracking SSH keys which use bcrypt_pbkdf.
I am running ssh-keygen from
openssh-7.2p2, and JtR jumbo can't crack the hashes for the following files, even when the password is in the dictionary.Correction: The ssh-test1 file is cracked but ssh-test2 isn't.
FWIW, JtR jumbo loaded the second file (ssh-test2) just fine for me.
@Apingis Which versions of OpenSSH are you running? Can you please attach both the generated test SSH keys here?
I vaguely remember
bcrypt_pbkdfbeing changed in the past. Usage of two different variants of bcrypt_pbkdf might be causing some of the problems we are observing.I also see an old commit message of mine, which indicates that the quality, and correctness of this code is questionable at best.
I never got around to fixing this code.
Finally, I am seeing lots of false positives while cracking such keys. This is because only the CBC padding check is currently implemented for such keys. This needs to be fixed as well.
@kholia commented on GitHub (Jul 11, 2017):
PR #2626 fixes the iteration count problem.
The CBC padding check is not correct for all cases (keys). For some keys, the padding length can be zero bytes, which results in false negatives with our current code.
@kholia commented on GitHub (Jul 11, 2017):
@Apingis Thanks for bringing this issue to my attention! It should be mostly fixed in PR #2627.
One of the reasons that your Perl hack wasn't working is that the
iteration countis not the field adjacent to the$sshng$2string. The iteration count is the last field in the hash. Actually, with the new PR, it the second last field in the hash.@Apingis commented on GitHub (Jul 11, 2017):
OpenSSH version:
OpenSSH_7.5p1, OpenSSL 1.0.2k
@kholia I've updated from PR #2627, both previously mentioned keys were cracked.
As for John unable to load edited hash, that was other record referenced (with the same value), there's no issue.