openwall / openwall/john

config overriding PEBCAK and possible improvements of it

Open
#4,109 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When I try to override 1 option using other config file, I make new [Options] section and put my option there. All previous options are wiped and only new option is set. It does not look right.

I wrote that PristineGecos turns on JumboSingleWords. That was just hard-coded default value Y for JumboSingleWords was recovered by new [Options].

JFYI the default in loader.c:

	jumbo_split_string =
		cfg_get_bool(SECTION_OPTIONS, NULL, "JumboSingleWords", 1);

The default options:

$ ./JohnTheRipper/run/john --list=parameters:options
[...]
jumbosinglewords = N
pristinegecos = N
[...]

My way to inject option:

$ printf '.include <john.conf>\n[Options]\nPristineGecos = Y\n' > t.conf

$ ./JohnTheRipper/run/john --config=t.conf --list=parameters:options
pristinegecos = Y

Through john-local.conf:

$ printf '[Options]\nPristineGecos = Y\n' > john-local.conf

$ ./JohnTheRipper/run/john --list=parameters:options
pristinegecos = Y

From john.conf:

# include john-local.conf (This file can be created by user, to override defaults in this john.conf file)
.include '$JOHN/john-local.conf'

# include john-local.conf in local dir, it can override john.conf, john-local.conf (or any other conf file loaded)
.include './john-local.conf'

It does not seem like the main john.conf is intended for changes by end users. So with current implementation, one would need to copy the whole section, but not the whole file (because some sections would produce warnings about multiple declaration and the includes in the end would cause recursion).

john is quite fresh:

$ ./JohnTheRipper/run/john --list=build-info
Version: 1.9.0-jumbo-1+bleeding-ea33667eb 2019-09-23 12:43:34 +0200
Build: linux-gnu 64-bit x86_64 AVX2 AC OMP

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 in loader.c around the cfg_get_bool call and trace how repeated [Options] sections and included configuration files are loaded. Reproduce the examples with john-local.conf and --config=t.conf, then verify that overriding one option preserves the other options when --list=parameters:options is run.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.