openwall / openwall/john

Bump RULE_RANGES_MAX and add warning when limit is reached

Open
#2,684 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

http://www.openwall.com/lists/john-users/2017/08/18/2

On Fri, Aug 18, 2017 at 03:09:36PM +0200, Virginie trinite wrote:
> I try to retrieve a password of mine, for which  I do not remember where I
> put the uppercase.
> I find this interesting rules, which do what I want but only for the first
> 14 characters, and my password is very long.
>
> [List.Rules:NT]
> l
> lMT[*0]T[*1]T[*2]T[*3]T[*4]T[*5]T[*6]T[*7]T[*8]T[*9]T[*A]T[*B]T[*C]T[*D]Q
>
> I try to extend it, but as soon as I arrive to G, it doesn't work anymore.
> As variable G has nothing specific, I wonder where is the problem
>
> [List.Rules:NT]
> l
> lMT[*0]T[*1]T[*2]T[*3]T[*4]T[*5]T[*6]T[*7]T[*8]T[*9]T[*A]T[*B]T[*C]T[*D]T[*E]T[*F]T[*G]Q
>
> It says Invalid rule in ./john.conf at line 631: Invalid position code

You're bumping into this limit in params.h:

/*
 * Maximum number of character ranges for rules.
 */
#define RULE_RANGES_MAX                 16

You can raise it and recompile.  And given your reasonable use case,
maybe we need to raise the default for this parameter, say, to 30.

Maybe we also need to report an error when this limit is hit, instead of
silently not performing the preprocessor expansion (which results in
confusing error messages from further processing, like you have seen).

Also related: JtR performs preprocessor expansion of the rules at
startup, to count the expanded rules (such as for progress reporting)
and validate their syntax.  With extreme use of the preprocessor like
this, JtR startup may be slow.  Too many expanded rules may also
overflow the integer variables (but your specific use is safe in this
respect, as long as you don't go beyond 30 preprocessor expansions).

Alexander

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the RULE_RANGES_MAX definition in params.h and trace the rule preprocessor path that handles range expansion and reports invalid rules. Raise the default limit to 30 and ensure reaching the limit produces an explicit warning instead of silently skipping expansion; verify the reported behavior with the long rule example from the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.