[GH-ISSUE #1135] Self-test technical issue with some dynamic formats #710

Closed
opened 2026-10-14 03:21:01 +07:00 by bsakaguchi · 5 comments
Owner

Originally created by @magnumripper on GitHub (Mar 22, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1135

During a --stress-test=0 -form=dynamic, on second and later runs:

Testing: FormSpring [sha256($s.$p) 128/128 AVX 4x]... FAILED (plaintext_length)
Testing: hMailServer [sha256($s.$p) 128/128 AVX 4x]... FAILED (plaintext_length)
Testing: MediaWiki [md5($s.md5($p)) 128/128 AVX 8x4x4]... FAILED (plaintext_length)
Testing: md5ns, Netscreen [md5($s.$p) (OSC) (PW > 31 bytes, sse2) 128/128 AVX 8x4x4]... FAILED (plaintext_length)
Testing: osc, osCommerce [md5($s.$p) (OSC) 128/128 AVX 8x4x4]... FAILED (plaintext_length)
Testing: phpass ($P$9) [phpass ($P$ or $H$) 128/128 AVX 4x4x4]... FAILED (plaintext_length)
Testing: PHPS [md5(md5($p).$s) 128/128 AVX 8x4x4]... FAILED (plaintext_length)
Testing: pix-md5, Cisco PIX [Cisco PIX (MD5) 128/128 AVX 8x4x4]... FAILED (plaintext_length)

Cludges were added (6c867800c7) for similar problems with UTF-16 formats. They often do things like self->params.plaintext_length *= 3 for UTF-8 input and obviously the second time they do that, things are starting to get bad. The above formats probably have some similar issue. This is more or less a bug in --stress-test rather than in the formats but we should try to fix it.

Originally created by @magnumripper on GitHub (Mar 22, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1135 During a `--stress-test=0 -form=dynamic`, on _second_ and later runs: ``` Testing: FormSpring [sha256($s.$p) 128/128 AVX 4x]... FAILED (plaintext_length) Testing: hMailServer [sha256($s.$p) 128/128 AVX 4x]... FAILED (plaintext_length) Testing: MediaWiki [md5($s.md5($p)) 128/128 AVX 8x4x4]... FAILED (plaintext_length) Testing: md5ns, Netscreen [md5($s.$p) (OSC) (PW > 31 bytes, sse2) 128/128 AVX 8x4x4]... FAILED (plaintext_length) Testing: osc, osCommerce [md5($s.$p) (OSC) 128/128 AVX 8x4x4]... FAILED (plaintext_length) Testing: phpass ($P$9) [phpass ($P$ or $H$) 128/128 AVX 4x4x4]... FAILED (plaintext_length) Testing: PHPS [md5(md5($p).$s) 128/128 AVX 8x4x4]... FAILED (plaintext_length) Testing: pix-md5, Cisco PIX [Cisco PIX (MD5) 128/128 AVX 8x4x4]... FAILED (plaintext_length) ``` Cludges were added (6c867800c7) for similar problems with UTF-16 formats. They often do things like `self->params.plaintext_length *= 3` for UTF-8 input and obviously the _second_ time they do that, things are starting to get bad. The above formats probably have some similar issue. This is more or less a bug in `--stress-test` rather than in the formats but we should try to fix it.
bsakaguchi 2026-10-14 03:21:01 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@magnumripper commented on GitHub (Mar 26, 2015):

@jfoug I tried this

diff --git a/src/dynamic_fmt.c b/src/dynamic_fmt.c
index 3c86fd5..cecbdca 100644
--- a/src/dynamic_fmt.c
+++ b/src/dynamic_fmt.c
@@ -867,6 +867,8 @@ static void done(void)
 #endif
        MEM_FREE(eLargeOut);
        MEM_FREE(md5_unicode_convert);
+
+       fmt_Dynamic.private.initialized = 0;
 }

 /*********************************************************************************

It did not help but I might not have done it correctly. I assume you see what I'm aiming at - should it be written in some other way?

<!-- gh-comment-id:86582945 --> @magnumripper commented on GitHub (Mar 26, 2015): @jfoug I tried this ``` diff diff --git a/src/dynamic_fmt.c b/src/dynamic_fmt.c index 3c86fd5..cecbdca 100644 --- a/src/dynamic_fmt.c +++ b/src/dynamic_fmt.c @@ -867,6 +867,8 @@ static void done(void) #endif MEM_FREE(eLargeOut); MEM_FREE(md5_unicode_convert); + + fmt_Dynamic.private.initialized = 0; } /********************************************************************************* ``` It did not help but I might not have done it correctly. I assume you see what I'm aiming at - should it be written in some other way?
Author
Owner

@frank-dittrich commented on GitHub (Apr 28, 2015):

Apparently, plaintext_length is 0 when the test fails.

<!-- gh-comment-id:96963066 --> @frank-dittrich commented on GitHub (Apr 28, 2015): Apparently, plaintext_length is 0 when the test fails.
Author
Owner

@jfoug commented on GitHub (May 20, 2015):

The code in (6c86780) is setting the length to 0. I have to find out why.

<!-- gh-comment-id:103947221 --> @jfoug commented on GitHub (May 20, 2015): The code in (6c86780) is setting the length to 0. I have to find out why.
Author
Owner

@jfoug commented on GitHub (May 20, 2015):

This is why (in bench.c). All of these formats are thin, so there format structure is NOT filled out when this is called (in bench.c)

    /* FIXME: Kludge for thin dynamics, and OpenCL formats */
    /* c3_fmt also added, since it is a somewhat dynamic   */
    /* format and needs init called to change the name     */
    if ((format->params.flags & FMT_DYNAMIC) ||
        strstr(format->params.label, "-opencl") ||
        strcmp(format->params.label, "crypt")==0 )
        fmt_init(format);

If I change the code to this, the --stress test is fine, BUT I am not 100% sure what other side effects will happen.

    if (((format->params.flags & FMT_DYNAMIC) ||
    strstr(format->params.label, "-opencl") ||
    strcmp(format->params.label, "crypt")==0)
    && !(options.flags & FLG_LOOPTEST))
        fmt_init(format);
<!-- gh-comment-id:103949305 --> @jfoug commented on GitHub (May 20, 2015): This is why (in bench.c). All of these formats are thin, so there format structure is NOT filled out when this is called (in bench.c) ``` /* FIXME: Kludge for thin dynamics, and OpenCL formats */ /* c3_fmt also added, since it is a somewhat dynamic */ /* format and needs init called to change the name */ if ((format->params.flags & FMT_DYNAMIC) || strstr(format->params.label, "-opencl") || strcmp(format->params.label, "crypt")==0 ) fmt_init(format); ``` If I change the code to this, the --stress test is fine, BUT I am not 100% sure what other side effects will happen. ``` C if (((format->params.flags & FMT_DYNAMIC) || strstr(format->params.label, "-opencl") || strcmp(format->params.label, "crypt")==0) && !(options.flags & FLG_LOOPTEST)) fmt_init(format); ```
Author
Owner

@jfoug commented on GitHub (May 20, 2015):

Here is the side effect:

Testing: FormSpring [?]... PASS
Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS
Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS
Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS
Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS
Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS

Note the first line. It was done prior to the init() call being done. That is why we added init()

This is the output when the init() is called (i.e. prior to the change I show)

Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS
Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length)

Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length)

Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length)

Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length)

Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length)
<!-- gh-comment-id:103951244 --> @jfoug commented on GitHub (May 20, 2015): Here is the side effect: ``` Testing: FormSpring [?]... PASS Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS ``` Note the first line. It was done prior to the init() call being done. That is why we added init() This is the output when the init() is called (i.e. prior to the change I show) ``` Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) PASS Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length) Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length) Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length) Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length) Testing: FormSpring [sha256($s.$p) 128/128 SSE2 4x]... (8xOMP) FAILED (plaintext_length) ```
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#710
No description provided.