[GH-ISSUE #949] PFX, ASAN crash #548

Closed
opened 2026-10-14 03:12:51 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @magnumripper on GitHub (Dec 24, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/949

Originally assigned to: @magnumripper on GitHub.

From a -test -form:cpu run:

Benchmarking: PFX, PKCS12 (.pfx, .p12) [32/64]... (8xOMP) 
=================================================================
==10903==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000e831d6 at pc 0x10a26130b bp 0x7fff57114730 sp 0x7fff57114708
READ of size 1 at 0x602000e831d6 thread T0
    #0 0x10a26130a in wrap_atoi (in libasan.1.dylib) + 186
    #1 0x108e16908 in valid pfx_fmt_plug.c:135
    #2 0x108ee52af in fmt_self_test formats.c:300
    #3 0x108ecc4c9 in benchmark_format bench.c:178
    #4 0x108ece043 in benchmark_all bench.c:544
    #5 0x108ef7043 in john_run john.c:1282
    #6 0x108ef8a4d in main john.c:1651
    #7 0x7fff8a22c5c8 in start (in libdyld.dylib) + 0
    #8 0x2

0x602000e831d6 is located 0 bytes to the right of 6-byte region [0x602000e831d0,0x602000e831d6)
allocated by thread T0 here:
    #0 0x10a264a17 in wrap_strdup (in libasan.1.dylib) + 455
    #1 0x108e168dd in valid pfx_fmt_plug.c:130
    #2 0x108ee52af in fmt_self_test formats.c:300
    #3 0x108ecc4c9 in benchmark_format bench.c:178
    #4 0x108ece043 in benchmark_all bench.c:544
    #5 0x108ef7043 in john_run john.c:1282
    #6 0x108ef8a4d in main john.c:1651
    #7 0x7fff8a22c5c8 in start (in libdyld.dylib) + 0
    #8 0x2

SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ??
Shadow bytes around the buggy address:
  0x1c04001d05e0: fa fa fd fa fa fa 00 00 fa fa fd fa fa fa 02 fa
  0x1c04001d05f0: fa fa fd fd fa fa fd fa fa fa 00 00 fa fa 00 00
  0x1c04001d0600: fa fa 00 01 fa fa 02 fa fa fa 00 00 fa fa fd fd
  0x1c04001d0610: fa fa 02 fa fa fa 00 01 fa fa 00 00 fa fa 00 00
  0x1c04001d0620: fa fa 05 fa fa fa 00 00 fa fa 05 fa fa fa 00 00
=>0x1c04001d0630: fa fa fa fa fa fa fa fa fa fa[06]fa fa fa fa fa
  0x1c04001d0640: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c04001d0650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c04001d0660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c04001d0670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x1c04001d0680: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Contiguous container OOB:fc
  ASan internal:           fe
==10903==ABORTING
Originally created by @magnumripper on GitHub (Dec 24, 2014). Original GitHub issue: https://github.com/openwall/john/issues/949 Originally assigned to: @magnumripper on GitHub. From a `-test -form:cpu` run: ``` Benchmarking: PFX, PKCS12 (.pfx, .p12) [32/64]... (8xOMP) ================================================================= ==10903==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000e831d6 at pc 0x10a26130b bp 0x7fff57114730 sp 0x7fff57114708 READ of size 1 at 0x602000e831d6 thread T0 #0 0x10a26130a in wrap_atoi (in libasan.1.dylib) + 186 #1 0x108e16908 in valid pfx_fmt_plug.c:135 #2 0x108ee52af in fmt_self_test formats.c:300 #3 0x108ecc4c9 in benchmark_format bench.c:178 #4 0x108ece043 in benchmark_all bench.c:544 #5 0x108ef7043 in john_run john.c:1282 #6 0x108ef8a4d in main john.c:1651 #7 0x7fff8a22c5c8 in start (in libdyld.dylib) + 0 #8 0x2 0x602000e831d6 is located 0 bytes to the right of 6-byte region [0x602000e831d0,0x602000e831d6) allocated by thread T0 here: #0 0x10a264a17 in wrap_strdup (in libasan.1.dylib) + 455 #1 0x108e168dd in valid pfx_fmt_plug.c:130 #2 0x108ee52af in fmt_self_test formats.c:300 #3 0x108ecc4c9 in benchmark_format bench.c:178 #4 0x108ece043 in benchmark_all bench.c:544 #5 0x108ef7043 in john_run john.c:1282 #6 0x108ef8a4d in main john.c:1651 #7 0x7fff8a22c5c8 in start (in libdyld.dylib) + 0 #8 0x2 SUMMARY: AddressSanitizer: heap-buffer-overflow ??:0 ?? Shadow bytes around the buggy address: 0x1c04001d05e0: fa fa fd fa fa fa 00 00 fa fa fd fa fa fa 02 fa 0x1c04001d05f0: fa fa fd fd fa fa fd fa fa fa 00 00 fa fa 00 00 0x1c04001d0600: fa fa 00 01 fa fa 02 fa fa fa 00 00 fa fa fd fd 0x1c04001d0610: fa fa 02 fa fa fa 00 01 fa fa 00 00 fa fa 00 00 0x1c04001d0620: fa fa 05 fa fa fa 00 00 fa fa 05 fa fa fa 00 00 =>0x1c04001d0630: fa fa fa fa fa fa fa fa fa fa[06]fa fa fa fa fa 0x1c04001d0640: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x1c04001d0650: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x1c04001d0660: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x1c04001d0670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa 0x1c04001d0680: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa Shadow byte legend (one shadow byte represents 8 application bytes): Addressable: 00 Partially addressable: 01 02 03 04 05 06 07 Heap left redzone: fa Heap right redzone: fb Freed heap region: fd Stack left redzone: f1 Stack mid redzone: f2 Stack right redzone: f3 Stack partial redzone: f4 Stack after return: f5 Stack use after scope: f8 Global redzone: f9 Global init order: f6 Poisoned by user: f7 Contiguous container OOB:fc ASan internal: fe ==10903==ABORTING ```
bsakaguchi 2026-10-14 03:12:51 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@magnumripper commented on GitHub (Dec 24, 2014):

That happened once but I can't reproduce :-(

I also can't see how/why atoi(p) would ever fail in the below.

static int valid(char *ciphertext, struct fmt_main *self)
{
    char *ctcopy, *p, *keeptr, *decoded = NULL;
    PKCS12 *p12 = NULL;
    BIO *bp = NULL;
    int len, i;
    if (strncmp(ciphertext, "$pfx$", 5))
        return 0;
    ctcopy = strdup(ciphertext);
    keeptr = ctcopy;
    ctcopy += 6;
    if ((p = strtok(ctcopy, "*")) == NULL)  /* length */
        goto err;
    len = atoi(p);

The last line here is line 135.

<!-- gh-comment-id:68059586 --> @magnumripper commented on GitHub (Dec 24, 2014): That happened once but I can't reproduce :-( I also can't see how/why atoi(p) would ever fail in the below. ``` static int valid(char *ciphertext, struct fmt_main *self) { char *ctcopy, *p, *keeptr, *decoded = NULL; PKCS12 *p12 = NULL; BIO *bp = NULL; int len, i; if (strncmp(ciphertext, "$pfx$", 5)) return 0; ctcopy = strdup(ciphertext); keeptr = ctcopy; ctcopy += 6; if ((p = strtok(ctcopy, "*")) == NULL) /* length */ goto err; len = atoi(p); ``` The last line here is line 135.
Author
Owner

@magnumripper commented on GitHub (Dec 24, 2014):

I'm closing this as invalid. Must have been a glitch in ASAN or cosmic radiation or whatever, but there sure is no bug in that code.

<!-- gh-comment-id:68060315 --> @magnumripper commented on GitHub (Dec 24, 2014): I'm closing this as invalid. Must have been a glitch in ASAN or cosmic radiation or whatever, but there sure is no bug in that code.
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#548
No description provided.