[GH-ISSUE #1988] Multiple dynamic scripts using same dyna number should warn user. #1331

Closed
opened 2026-10-14 03:44:29 +07:00 by bsakaguchi · 17 comments
Owner

Originally created by @jfoug on GitHub (Jan 11, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/1988

I am not sure how this will be done. I think the information about duplication is already lost by the time we get to dyna loading. But I am adding this issue, just in case someone has an idea on how to do this.

Originally created by @jfoug on GitHub (Jan 11, 2016). Original GitHub issue: https://github.com/openwall/john/issues/1988 I am not sure how this will be done. I think the information about duplication is already lost by the time we get to dyna loading. But I am adding this issue, just in case someone has an idea on how to do this.
Author
Owner

@frank-dittrich commented on GitHub (Jan 11, 2016):

I guess it is the same with two List.Rules sections with the same name:

$ head -n 6 john-local.conf 
[List.Rules:test1]
A0"test1"

[List.Rules:test1]
Az"test1"

$ ./john --stdout --wordlist --rules=test1|head
Press 'q' or Ctrl-C to abort, almost any other key for status
123456test1
12345test1
passwordtest1
password1test1
123456789test1
12345678test1
1234567890test1
abc123test1
computertest1
tiggertest1

So, the second definition just overwrites the first without any warning.

Now we can label it as a core John (master) bug.

<!-- gh-comment-id:170679107 --> @frank-dittrich commented on GitHub (Jan 11, 2016): I guess it is the same with two List.Rules sections with the same name: ``` $ head -n 6 john-local.conf [List.Rules:test1] A0"test1" [List.Rules:test1] Az"test1" ``` ``` $ ./john --stdout --wordlist --rules=test1|head Press 'q' or Ctrl-C to abort, almost any other key for status 123456test1 12345test1 passwordtest1 password1test1 123456789test1 12345678test1 1234567890test1 abc123test1 computertest1 tiggertest1 ``` So, the second definition just overwrites the first without any warning. Now we can label it as a core John (master) bug.
Author
Owner

@jfoug commented on GitHub (Jan 11, 2016):

Not sure calling it a 'bug' is right. This is a 'feature', lol. It was done this way by design. For rules, it may make sense to do this. non-jumbo john does not have -rules=xxx Only -rules But for dynamic, it does not make as much since. Once a number is 'used', redefining it to some other hash would be a big usage problem.

BUT figuring this one out is NOT trivial, unless you read in dynamic.conf (and anything it loads) and parse it out, without using the config code already writing into jtr.

<!-- gh-comment-id:170681873 --> @jfoug commented on GitHub (Jan 11, 2016): Not sure calling it a 'bug' is right. This is a 'feature', lol. It was done this way by design. For rules, it may make sense to do this. non-jumbo john does not have -rules=xxx Only -rules But for dynamic, it does not make as much since. Once a number is 'used', redefining it to some other hash would be a big usage problem. BUT figuring this one out is NOT trivial, unless you read in dynamic.conf (and anything it loads) and parse it out, without using the config code already writing into jtr.
Author
Owner

@frank-dittrich commented on GitHub (Jan 11, 2016):

It is the same with parameter sections.
This is the redefinition in my local config. I didn't use [Local:Markov:Default] as a section name, that's why the MkvLvl definition is gone now. (My local definition just has Statsfile and MkvMaxLen.)

$ ../run/john --list=parameters:markov:default 
statsfile = $JOHN/stats
mkvmaxlen = 11

And --list=listdata:section also shows the last definition:

$ ./john --list=list-data:list.rules:test1 
Az"test1"
<!-- gh-comment-id:170682144 --> @frank-dittrich commented on GitHub (Jan 11, 2016): It is the same with parameter sections. This is the redefinition in my local config. I didn't use `[Local:Markov:Default]` as a section name, that's why the MkvLvl definition is gone now. (My local definition just has Statsfile and MkvMaxLen.) ``` $ ../run/john --list=parameters:markov:default statsfile = $JOHN/stats mkvmaxlen = 11 ``` And --list=listdata:section also shows the last definition: ``` $ ./john --list=list-data:list.rules:test1 Az"test1" ```
Author
Owner

@frank-dittrich commented on GitHub (Jan 11, 2016):

But redefining a rules section also is a big usage problem, say you just restart a session which resumes with the redefinition instead the original section...

<!-- gh-comment-id:170682582 --> @frank-dittrich commented on GitHub (Jan 11, 2016): But redefining a rules section also is a big usage problem, say you just restart a session which resumes with the redefinition instead the original section...
Author
Owner

@jfoug commented on GitHub (Jan 11, 2016):

This is just the 'common' code within configure. it will overwrite already existing lines when reading.

<!-- gh-comment-id:170682622 --> @jfoug commented on GitHub (Jan 11, 2016): This is just the 'common' code within configure. it will overwrite already existing lines when reading.
Author
Owner

@frank-dittrich commented on GitHub (Jan 11, 2016):

My examples weren't about overwriting existing lines (That would be [Local:...] sections, but about overwriting complete sections.

<!-- gh-comment-id:170683012 --> @frank-dittrich commented on GitHub (Jan 11, 2016): My examples weren't about overwriting existing lines (That would be `[Local:...]` sections, but about overwriting complete sections.
Author
Owner

@jfoug commented on GitHub (Jan 11, 2016):

I would be very hesitant about changing the current behavior. BUT I think a warning being written each time it happens (section) might be good to do. At least the user would be made aware that an already defined section has been replaced, and that there may be a problem with the setup to investigate.

<!-- gh-comment-id:170683540 --> @jfoug commented on GitHub (Jan 11, 2016): I would be very hesitant about changing the current behavior. BUT I think a warning being written each time it happens (section) might be good to do. At least the user would be made aware that an already defined section has been replaced, and that there may be a problem with the setup to investigate.
Author
Owner

@frank-dittrich commented on GitHub (Jan 11, 2016):

Yes sure, I'd also suggest to just print a warning (with --verbosity >= 3)

<!-- gh-comment-id:170683862 --> @frank-dittrich commented on GitHub (Jan 11, 2016): Yes sure, I'd also suggest to just print a warning (with --verbosity >= 3)
Author
Owner

@magnumripper commented on GitHub (Jan 11, 2016):

Would we want that warning when using john-local.conf? I think not. Perhaps at verbosity > 3.

<!-- gh-comment-id:170684026 --> @magnumripper commented on GitHub (Jan 11, 2016): Would we want that warning when using john-local.conf? I think not. Perhaps at verbosity > 3.
Author
Owner

@frank-dittrich commented on GitHub (Jan 11, 2016):

I never change john.conf, just john[.-]local.conf, so a warning with verbosity > 3 would be almost useless.

BTW, it could be we have a memleak for multiple sections with the same name /just looking at cfg_add_section now, didn't tst with ASan, and may be I had one beer too much.

<!-- gh-comment-id:170684764 --> @frank-dittrich commented on GitHub (Jan 11, 2016): I never change john.conf, just john[.-]local.conf, so a warning with verbosity > 3 would be almost useless. BTW, it could be we have a memleak for multiple sections with the same name /just looking at cfg_add_section now, didn't tst with ASan, and may be I had one beer too much.
Author
Owner

@jfoug commented on GitHub (Jan 11, 2016):

There will be no 'shown' memleak. Almost all conf code uses mem_alloc_tiny

<!-- gh-comment-id:170685035 --> @jfoug commented on GitHub (Jan 11, 2016): There will be no 'shown' memleak. Almost all conf code uses mem_alloc_tiny
Author
Owner

@jfoug commented on GitHub (Jan 15, 2016):

The above commit has this logic:

If a non-merged section starting with 'list.' is replaced and we are not processing john-local.conf, then we always emit a warning. If we need to fine tune the output, it should be easy, but at least this is the location WHERE this warning logic needs to be placed.

<!-- gh-comment-id:172063996 --> @jfoug commented on GitHub (Jan 15, 2016): The above commit has this logic: If a non-merged section starting with 'list.' is replaced and we are not processing john-local.conf, then we always emit a warning. If we need to fine tune the output, it should be easy, but at least this is the location WHERE this warning logic needs to be placed.
Author
Owner

@magnumripper commented on GitHub (Jan 15, 2016):

Sounds good

<!-- gh-comment-id:172071917 --> @magnumripper commented on GitHub (Jan 15, 2016): Sounds good
Author
Owner

@jfoug commented on GitHub (Jan 15, 2016):

So this is 'good enough'. If so, this bug is closed. I know the 2 of you bounced some additional ideas around. This change does not go that far. It simply always 'warns', UNTIL you get to john-local.conf. I did not warn there, but possibly we should even warn there ?...?

<!-- gh-comment-id:172073287 --> @jfoug commented on GitHub (Jan 15, 2016): So this is 'good enough'. If so, this bug is closed. I know the 2 of you bounced some additional ideas around. This change does not go that far. It simply always 'warns', UNTIL you get to john-local.conf. I did not warn there, but possibly we should even warn there ?...?
Author
Owner

@frank-dittrich commented on GitHub (Jan 15, 2016):

Why only warn when the redefinition is outside john-local.conf?
I can't see why you would want to redefine a john.conf section in john-local.conf. Any examples where this would be desired?

<!-- gh-comment-id:172103376 --> @frank-dittrich commented on GitHub (Jan 15, 2016): Why only warn when the redefinition is outside john-local.conf? I can't see why you would want to redefine a john.conf section in john-local.conf. Any examples where this would be desired?
Author
Owner

@frank-dittrich commented on GitHub (Jan 15, 2016):

Furthermore, without seeing a valid reason to redefine a john.conf section, I would always assume a duplicate session name and thus a redefinition of a previous session is never intended.
May be a user isn't aware that section names are not case sensitive, and uses

[List.Rules:append_a]
<*$a


[List.Rules:append_A]
<*$A

That's why I'd prefer to always warn about the redefinition, even with default verbosity and even if the redefinition occurs in a local config file.

<!-- gh-comment-id:172105152 --> @frank-dittrich commented on GitHub (Jan 15, 2016): Furthermore, without seeing a valid reason to redefine a john.conf section, I would always assume a duplicate session name and thus a redefinition of a previous session is never intended. May be a user isn't aware that section names are not case sensitive, and uses ``` [List.Rules:append_a] <*$a [List.Rules:append_A] <*$A ``` That's why I'd prefer to always warn about the redefinition, even with default verbosity and even if the redefinition occurs in a local config file.
Author
Owner

@frank-dittrich commented on GitHub (Jan 16, 2016):

<!-- gh-comment-id:172179869 --> @frank-dittrich commented on GitHub (Jan 16, 2016): ##
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#1331
No description provided.