[GH-ISSUE #1120] Segfault in config file #697

Closed
opened 2026-10-14 03:20:36 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @loverszhaokai on GitHub (Mar 19, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1120

This segment fault is found by AFL fuzzing
#1. How to reproduce this segment fault

1.1 Change config file

Add '?' before List.Rules in line 739

 738# Default Loopback mode rules.
 739[?List.Rules:Loopback]
 740.include [List.Rules:NT]
 741.include [List.Rules:Split]

1.2 Run it with anything

./john ....
#2. How to fuzz config

$ cd JohnTheRipper/run
$ mkdir config_test
$ cd config_test
$ mkdir test_cases
$ cp ../john.conf  test_cases/
$ afl-fuzz -m none -t 1500+ -i test_cases/ -o out/  ../john  7z_fmt  --config=@@  --skip-self-test

#3. Why segment fault

file: src/config.c, list is NULL

static void cfg_add_line(char *line, int number)
{
    struct cfg_list *list;
    struct cfg_line *entry;

    entry = mem_alloc_tiny(sizeof(struct cfg_line), MEM_ALIGN_WORD);
    entry->next = NULL;

    entry->data = str_alloc_copy(line);
    entry->number = number;
    entry->cfg_name = cfg_name;

    list = cfg_database->list;
    if (list->tail) {
        entry->id = list->tail->id + 1;
        list->tail = list->tail->next = entry;
    }
    else {
        entry->id = 0;
        list->tail = list->head = entry;
    }
}
Originally created by @loverszhaokai on GitHub (Mar 19, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1120 This segment fault is found by AFL fuzzing #1. How to reproduce this segment fault ## 1.1 Change config file Add '?' before List.Rules in line 739 ``` 738# Default Loopback mode rules. 739[?List.Rules:Loopback] 740.include [List.Rules:NT] 741.include [List.Rules:Split] ``` ## 1.2 Run it with anything ./john .... #2. How to fuzz config ``` shell $ cd JohnTheRipper/run $ mkdir config_test $ cd config_test $ mkdir test_cases $ cp ../john.conf test_cases/ $ afl-fuzz -m none -t 1500+ -i test_cases/ -o out/ ../john 7z_fmt --config=@@ --skip-self-test ``` #3. Why segment fault file: **src/config.c**, list is **NULL** ``` static void cfg_add_line(char *line, int number) { struct cfg_list *list; struct cfg_line *entry; entry = mem_alloc_tiny(sizeof(struct cfg_line), MEM_ALIGN_WORD); entry->next = NULL; entry->data = str_alloc_copy(line); entry->number = number; entry->cfg_name = cfg_name; list = cfg_database->list; if (list->tail) { entry->id = list->tail->id + 1; list->tail = list->tail->next = entry; } else { entry->id = 0; list->tail = list->head = entry; } } ```
bsakaguchi 2026-10-14 03:20:36 +07:00
  • closed this issue
  • added the
    bug
    label
bsakaguchi changed title from [GH-ISSUE #1120] Segfault in config file to [GH-ISSUE #1120] Segfault in config file 2026-10-15 04:10:04 +07:00
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#697
No description provided.