mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2575] Add support for other mscash2 format (used by metasploit) #1690
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#1690
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 @Rogdham on GitHub (Jun 14, 2017).
Original GitHub issue: https://github.com/openwall/john/issues/2575
The cachedump module of metasploit returns mscash2 hash in the following form:
january:$DCC2$#january#26b5495b21f9ad58255d99b5e117abe2:domain.local:DOMAIN(password is
verylongpassword)This format is not properly recognised by john. Although there is no iteration value, it should be using the default number (10240) just as it is the case in the following form (correctly recognised by john):
january:$DCC2$january#26b5495b21f9ad58255d99b5e117abe2:domain.local:DOMAINNotice that there is no
#between$DCC2$andjanuary.It think that adding a case just like this one should solve this issue, but I don't know the codebase well enough to be sure.
Steps to reproduce
The lines above should recover the pasword.
System configuration
Using latest bleeding-jumbo version from git:
John the Ripper 1.8.0-jumbo-1-5697-gea2f5a909+ OMP [linux-gnu 64-bit AVX2-ac]@kholia commented on GitHub (Jun 15, 2017):
@magnumripper The following patch adds support for such hashes,
Does it look correct?
@frank-dittrich commented on GitHub (Jun 15, 2017):
What if
#januaryis used as a salt in our current implementation?May be we replaced
$#with$some time in the past, to get rid of the unnecessary#.?If metasploit uses
$#here, we should as well, and add a comment.(Or metasploit can be changed.)
@Rogdham commented on GitHub (Jun 15, 2017):
I don't know enough all mscash2 formats to know for sure, but I can confirm that @kholia's patch allows to crack the hash output by metasploit.
I've open a bug report.
However, I think that is would be better if john does crack this format because there will always be people running older versions of metasploit, plus the format may be used in other tools as well.
@jfoug commented on GitHub (Jun 15, 2017):
What if a '#' char is used ANYWHERE in the salt?? I think we need to find the 32 byte hex string that is appended by the '#' char and the salt preceeds that. However, @frank-dittrich is right, even doing that, we will not be able to handle a salt that starts with a # char, once we take this route. It would almost be better to make a pre-processing tool for these hashes, that convert them INTO johns canonical format, and not handle these natively. Knowledge that the '#' starting a salt will render john unusable might be used, by intelligent people.
As was also listed, metasploit should not have made up their own hash format...... but used the existing defacto format.
Just saying.
@Rogdham commented on GitHub (Jun 15, 2017):
Just to be sure that I understand things correctly:
$DCC2$#january#26b5495b21f9ad58255d99b5e117abe2is understood by john as 10240 iterations with salt#januaryjanuary, we will not be able to crack hash with salt starting with#Assuming the above is true, could we not just use the following hash for
#januaryas salt :$DCC2$10240##january#26b5495b21f9ad58255d99b5e117abe2(i.e. double#) ?If so, it is just a matter of what should be the default understanding of the
$DCC2$#january#26b5495b21f9ad58255d99b5e117abe2format. In that case, I am not sure. metasploit is using that format (i.e. meaningjanuaryas salt), what tools use the same format with the other meaning (i.e.#januaryas salt)?@frank-dittrich commented on GitHub (Jun 15, 2017):
What is hashcat using? I think, if metasploit and hashcat use the same layout, john should be adjusted, and the need for the extra # should be documented.
@Rogdham commented on GitHub (Jun 15, 2017):
I was also thinking: what is the current way to mean 20480 iterations with salt
#january?@magnumripper commented on GitHub (Jun 16, 2017):
Definitely agreed. Our mscash2 format pre-dates the whole metasploit project AFAIK. I vote for not working around their mistakes unless we are really forced to.
That would be
$DCC2$20480##januari#c6758e5be7fc943d00b97972a8a97620. We find the last#searching backwards from end. We should add a test vector for this case.@Rogdham commented on GitHub (Jun 16, 2017):
My point was that if john can add metasploit's format without having any side effect, then that format could just be added. However, if that would break anything, I would be ok with just closing that issue.
As far as I understand this, it would break the current behaviour when no iteration count is specified, and the salt starts with a
#(note that this hash would be still crackable by re-formatting it, see below). @magnumripper: could you confirm and do you think that this case is a dealbreaker?Ok, makes sense. In that case,
$DCC2$10240##january#26b5495b21f9ad58255d99b5e117abe2should work to handle salts starting with#(in answer of the part of @jfoug's comment above).@magnumripper commented on GitHub (Jun 16, 2017):
There were actually bugs in some code paths. All should be fixed now (test vectors are added)
Absolutely. I looked into that but unfortunately it would break things. AFAIK we have always parsed
$DCC2$#january#26b5495b21f9ad58255d99b5e117abe2as a salt of#january. Metasploit needs to fix their code. BTW in your issue there (https://github.com/rapid7/metasploit-framework/issues/8560) you should point out to them that the current format isn't correct and never was. That is, not listing iteration count is supported (albeit stupid) but then it has to be written as$DCC2$january#26b5495b21f9ad58255d99b5e117abe2without the extra#.BTW hashcat does parse the current Metasploit hash correctly but OTOH hashcat doesn't support a salt including
#at all (which is a bug IMHO).Bottom line is we're not going to add a workaround for this case, so I'm closing. But feel free to comment further or challenge my opinions 😉
@frank-dittrich commented on GitHub (Jun 16, 2017):
@magnumripper Did you check our git history?
May be we used the extra # in the past, metasploit and hashcat copied it from us, and then we dropped it.
@Rogdham commented on GitHub (Jun 16, 2017):
Ok, I will go back to metasploit to make sure that they output correct hashes.
Many thanks to all of you for the time you took looking at this issue! 👍
@magnumripper commented on GitHub (Jun 16, 2017):
I didn't bother but it doesn't matter. The format they use aren't shown in any sample nor documented anywhere. It's got to be a mistake.