mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1748] Dynamic ad-hoc format: AM "complex" does not work #1158
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#1158
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 @magnumripper on GitHub (Sep 11, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1748
Originally assigned to: @jfoug on GitHub.
I think I write it correctly. Why is it not recognized at all?
@magnumripper commented on GitHub (Sep 11, 2015):
Tried hexifying @ and $, no difference
@frank-dittrich commented on GitHub (Sep 11, 2015):
Trying to reduce that:
@frank-dittrich commented on GitHub (Sep 11, 2015):
@jfoug commented on GitHub (Sep 11, 2015):
This should not have salt_as_hex set. lc($s) is not a hashing function.
I think the parser is failing. It must be using 'any' function as a salt_as hex, when parsing. It should ONLY do that for a hashing type. The uc/lc are not really functions. They just use function-like syntax
@jfoug commented on GitHub (Sep 11, 2015):
& has to be encoded (even in '...' the shell wants to start background processes)
*'may' have to be.@jfoug commented on GitHub (Sep 11, 2015):
I have to 'fix' the compiler to not treat lc($s) as a salt_as_hex type. For the above test, I removed the lc($s) and just use $s. Other than missing a dyna startup flag, the above format 'would' work. And if all the salts were already lower case in the input data, then this 'would' work.
@magnumripper commented on GitHub (Sep 11, 2015):
I can't see why any of them would have to be escaped. We are inside single quotes already so the shell is not involved at all - all problems here are the format's problems.
I can buy that
@and:need escaping since both have meanings to JtR.@magnumripper commented on GitHub (Sep 11, 2015):
It was the
*, not the&. I would like to know why*needs escaping. It's not used in dynamic, is it?@magnumripper commented on GitHub (Sep 11, 2015):
OK, here's why. Might even be my fault 😝
@magnumripper commented on GitHub (Sep 11, 2015):
This addresses the problem
But it ends up with an other problem
@magnumripper commented on GitHub (Sep 11, 2015):
OK...
lc($s)is simply not supported yet whilelc($u)andlc($p)are. So I think my patch above is correct, but we'd also need to actually supportlc($s).@magnumripper commented on GitHub (Sep 11, 2015):
We don't even have MGF_SALT_LOCASE or MGF_SALT_UPCASE.
@magnumripper commented on GitHub (Sep 11, 2015):
I'll admit it's not very relevant to support
lc($s)oruc($s)even though it'd be nice in this case. The easy solution is to prepare the input file correctly.@magnumripper commented on GitHub (Sep 11, 2015):
I will actually commit the patch above. It's relevant for getting the proper error, and if we'll support case-correcting
$sin the future, it still stands.Other than that, this issue is more or less PEBCAK.
@magnumripper commented on GitHub (Sep 11, 2015):
So @jfoug I'll let you decide: Either close this now, or implement lc/uc for salt.
Oh, and we should document which characters need escaping.
@jfoug commented on GitHub (Sep 11, 2015):
this 'fixes' the lc($s) not parsing, but there are only 2 valid uc/lc situations. That is user name and pass.
Remind me why casing of the salt is needed? Can't it just be properly built in the first place??
@magnumripper commented on GitHub (Sep 12, 2015):
Yeah, sure. I just wrote it as
lc($s)from a writeup about AM hashes. The solution is preparing the input.I'm fine with this issue being closed now that we get the proper error.
@jfoug commented on GitHub (Sep 12, 2015):
it's not an error if you are not 'trying' to support lc($s), but since lc() will parse (as will any expression.
wow. I just thought of something, do not submit that yet
@magnumripper commented on GitHub (Sep 12, 2015):
I already committed that SALT_AS_HEX parsing fix.
@jfoug commented on GitHub (Sep 12, 2015):
We have to whitelist what is allowed, not black list. Take this point
md5($p.fuckoff($s))
I think that will parse properly, because the optimizer will turn it into md5($p.$s), and set the 'this hash uses salt-as-hex' flag
@magnumripper commented on GitHub (Sep 12, 2015):
LOL so fuckoff() is a no-op
@jfoug commented on GitHub (Sep 12, 2015):
:) But then it will fail to find FUCKOFF_SALT_AS_HEX flag when later trying to emit the flag
@magnumripper commented on GitHub (Sep 12, 2015):
I'm laughing so much my wife will wake up. We definitely should have a FUCKOFF_SALT_AS_HEX flag just for the hell of it.
@jfoug commented on GitHub (Sep 12, 2015):
what I am saying is that the optimizer will have to white list (that sucks, because now I have to edit that WL every time I add a crypt type. So it will ONLY work for md5($s), or sha1($s) and anything else, it leaves alone, so that the original text is in there, and the parser will have context on what 'bad' part of the expressino was seen
@magnumripper commented on GitHub (Sep 12, 2015):
Yes I see what you mean. Unless you can find a nice way with that CPP magic stuff.
@jfoug commented on GitHub (Sep 12, 2015):
it will be with cpp magic, but it is just another edit point, no different than the rest. I just put a magic signature, then search for that, and wherever it is found, I figure out what needs to be there, and add it. At least I am not writing code into each of the 30 or so edit points.
@magnumripper commented on GitHub (Sep 12, 2015):
But this all can wait now. We should fix #1746 but I'm lost there.
@jfoug commented on GitHub (Sep 12, 2015):
it will be a macro that does something like:
CHK(A,B) if (offset > B && !strncmp(&p[- B], A)) valid=1
Then have a set of macros like:
valid=0;
CHK("md5(",4); CHK("md4(",4); CHK("sha1(",5); ....
if(valid) { /* do the logic */ }
@magnumripper commented on GitHub (Sep 12, 2015):
No wait, not #1746, I meant the build bot problems. We should open an issue for that.
@jfoug commented on GitHub (Sep 12, 2015):
I am leaving things alone right now, letting you dig in a bit. You might hopefully find stupid things I am doing, and help fix some design problems, in your digging in to understand just wtf is going on.
@jfoug commented on GitHub (Sep 12, 2015):
One thing I may end up doing, is to not use the parsed reverse polish type data, other than to syntax check, and then later to run to get the test vars. I may re-do the code emission module to work directly from the original expression. I toyed with that a bit, but stopped the implementation about the time the AM leak sprung. Going from that recursive stack machine, to a 2 variable large instruction set system where all you can do is overwrite/append/clear/hash, does not map well at all. Although I 'may' do this by building a 2nd emulator, and actually RUNNING the code again, keeping track of the state of the machine, so that I know var 1 is free, var 2 is used for this part of the sub expression, etc, etc. IF I can get the code working like that, then it would be about as perfect as you can get.If you can actually do the expression by hand, that type of a parser could build a script to do it. It is no where NEAR that powerful today. It works for many common cases, but falls apart when there are more than 2 parts of the sub expression that need to be tracked and worked on at the same time.
@magnumripper commented on GitHub (Sep 14, 2015):
Anyway this issue can be closed. The following works:
Verify the escapes:
Email address has to be lower-cased in input file, as in