[GH-ISSUE #1359] Config file does not exist #857

Closed
opened 2026-10-14 03:26:07 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @loverszhaokai on GitHub (May 27, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1359

#1. Reproduce

Is it all right that john does not report error when --config=file_does_exist ?

$ cat test_pw

$apr1$a2Jqm...$grFrwEgiQleDr0zR4Jx1b.

$ ../john test_pw --config=1111111111111111111111

Using default input encoding: UTF-8
Loaded 1 password hash (md5crypt, crypt(3) $1$ [MD5 256/256 AVX2 8x3])
Will run 8 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
0g 0:00:00:03  2/3 0g/s 7237p/s 7237c/s 7237C/s monday2..johnny2
Session aborted

#2. Analysis

In john.c, it allows the config file is missing.

void john_init()
{
    ....
    if (!make_check) {
        if (options.config)
        {
            cfg_init(options.config, 1);
        }
    }
    ....
}
void cfg_init(char *name, int allow_missing)
{
    ....
        cfg_name = str_alloc_copy(path_expand(name));
        file = fopen(cfg_name, "r");
        if (!file) {
                cfg_name = str_alloc_copy(path_expand_ex(name));
                file = fopen(cfg_name, "r");
                if (!file) {
                        if (allow_missing && errno == ENOENT) return;
                        pexit("fopen: %s", cfg_name);
                }
        }
    ....
}
Originally created by @loverszhaokai on GitHub (May 27, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1359 #1. Reproduce Is it all right that john does not report error when `--config=file_does_exist` ? $ cat test_pw ``` $apr1$a2Jqm...$grFrwEgiQleDr0zR4Jx1b. ``` $ ../john test_pw --config=1111111111111111111111 ``` Using default input encoding: UTF-8 Loaded 1 password hash (md5crypt, crypt(3) $1$ [MD5 256/256 AVX2 8x3]) Will run 8 OpenMP threads Press 'q' or Ctrl-C to abort, almost any other key for status 0g 0:00:00:03 2/3 0g/s 7237p/s 7237c/s 7237C/s monday2..johnny2 Session aborted ``` #2. Analysis In john.c, **it allows the config file is missing.** ``` C void john_init() { .... if (!make_check) { if (options.config) { cfg_init(options.config, 1); } } .... } ``` ``` C void cfg_init(char *name, int allow_missing) { .... cfg_name = str_alloc_copy(path_expand(name)); file = fopen(cfg_name, "r"); if (!file) { cfg_name = str_alloc_copy(path_expand_ex(name)); file = fopen(cfg_name, "r"); if (!file) { if (allow_missing && errno == ENOENT) return; pexit("fopen: %s", cfg_name); } } .... } ```
bsakaguchi 2026-10-14 03:26:07 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@magnumripper commented on GitHub (May 27, 2015):

I guess it purposely allows running john without a default config file present. But when we specify a config file, we shouldn't allow it to be missing.

<!-- gh-comment-id:105790180 --> @magnumripper commented on GitHub (May 27, 2015): I guess it purposely allows running john without a default config file present. But when we _specify_ a config file, we shouldn't allow it to be missing.
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#857
No description provided.