[GH-ISSUE #880] Salted formats which don't report tunable costs even if they should... #486

Closed
opened 2026-10-14 03:10:18 +07:00 by bsakaguchi · 7 comments
Owner

Originally created by @frank-dittrich on GitHub (Dec 14, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/880

Originally assigned to: @frank-dittrich on GitHub.

Not sure how to find out which formats still need to report tunable costs.
These must be formats with salt size > 0.
We have 204 CPU formats with salt size > 0 which don't yet report tunable costs:

(bleeding-jumbo)run $ ./john --list=format-details |cut -f 1,12,13|grep '\s$'|grep -v "\s0\s$" |wc -l
204

To find out which formats need to report tunable costs, we could compare test runs of individual hashes. Of ourse, this doesn't work for formats wich lack self tests for certain supported algorithms / varying cost parameters.
Out of the 204 formats, 9 just have a single self test:

 $ ./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep "\s[01]\s[0-9]"|cut -f 1,2
blackberry-es10 1
Clipperz    1
dmd5    1
fde 1
FormSpring  1
keystore    1
lp  1
LUKS    1
osc 1

But for the other formats, this might help:

$ ./john --list=format-tests |cut -f 4 |LC_ALL=C sort -u > passwords.test
Test scrypt 1: plaintext contains line feed
Test scrypt 1: ciphertext contains line feed or separator character '   '
(bleeding-jumbo)run $ wc -l passwords.test
537 passwords.test
$ ./john --incremental=upper --min-length=7 --max-length=7 --stdout | head -n 1000000 >> passwords.test 
Press 'q' or Ctrl-C to abort, almost any other key for status
$ ./unique passwords.u < passwords.test 
Total lines read 1000537 Unique lines written 1000537

Apparently, none of the self test passwords is among the first 1000000 candidates generated by my incremental mode run.
So we can just drop the top 537 lines, to get a suitable sample input file:

 $ tail -n +538 passwords.u > test.lst

And now let's collect the password hashes:

$ for f in `./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep -v "\s[01]\s[0-9]"|cut -f 1`; do ./john --format=$f --list=format-tests |cut -f 2,3| tr '\t' ':' > hashes.$f; done

Finally, a test run for each individual hash:

$ for f in $(./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep -v "\s[01]\s[0-9]"|cut -f 1); do echo "$f"; for u in $(seq 0 $(./john --format=$f --list=format-details |cut -f 6)); do echo "$f $u "; time ./john hashes.$f --format=$f --users=$u --wordlist=test.lst --session=$f-$u --pot=dummy.pot > stdout-$f-$u.txt 2> stderr-$f-$u.txt; done; done
descrypt
descrypt 0 

real    0m0.275s
user    0m1.043s
sys 0m0.016s
descrypt 1 

real    0m0.201s
user    0m0.967s
sys 0m0.011s
descrypt 2 

real    0m0.201s
user    0m0.970s
sys 0m0.009s
descrypt 3 

real    0m0.212s
user    0m0.970s
sys 0m0.011s
descrypt 4 

real    0m0.203s
user    0m0.984s
sys 0m0.008s
descrypt 5 

real    0m0.062s
user    0m0.058s
sys 0m0.004s
bsdicrypt
bsdicrypt 0 

real    0m2.471s
user    0m18.750s
sys 0m0.013s
bsdicrypt 1 

real    0m2.574s
user    0m19.715s
sys 0m0.007s
bsdicrypt 2 

real    0m2.638s
user    0m20.305s
sys 0m0.006s
bsdicrypt 3 

real    0m2.694s
user    0m20.691s
sys 0m0.015s
bsdicrypt 4 

real    0m2.840s
user    0m20.951s
sys 0m0.030s
bsdicrypt 5 

real    0m2.874s
user    0m21.296s
sys 0m0.026s
bsdicrypt 6 

real    0m2.798s
user    0m21.571s
sys 0m0.013s
bsdicrypt 7 

real    0m2.830s
user    0m21.766s
sys 0m0.014s
bsdicrypt 8 

real    0m2.946s
user    0m21.813s
sys 0m0.017s
bsdicrypt 9 

real    0m2.876s
user    0m22.155s
sys 0m0.015s
bsdicrypt 10 

real    0m2.960s
user    0m22.744s
sys 0m0.010s
bsdicrypt 11 

real    0m2.938s
user    0m22.504s
sys 0m0.013s
bsdicrypt 12 

real    0m0.079s
user    0m0.074s
sys 0m0.006s
...

Then, you can compare the run time of individual hashes (e.g., from the last line of the log files).
And if the ratio of fastest vs. slowest run justifies reporting a cost parameter, look into the format and find out what causes the different run time...

Some more scripting is required to automate this. (And may be we need to look into formats that lack some important self tests before doing this.)

(Of course, you'd need a system which doesn't throttle the CPU clock rate due to temperature, so my laptop isn't suitable.)

Not sure whether we should aim to complete this before the next jumbo release...

Originally created by @frank-dittrich on GitHub (Dec 14, 2014). Original GitHub issue: https://github.com/openwall/john/issues/880 Originally assigned to: @frank-dittrich on GitHub. Not sure how to find out which formats still need to report tunable costs. These must be formats with salt size > 0. We have 204 CPU formats with salt size > 0 which don't yet report tunable costs: ``` (bleeding-jumbo)run $ ./john --list=format-details |cut -f 1,12,13|grep '\s$'|grep -v "\s0\s$" |wc -l 204 ``` To find out which formats need to report tunable costs, we could compare test runs of individual hashes. Of ourse, this doesn't work for formats wich lack self tests for certain supported algorithms / varying cost parameters. Out of the 204 formats, 9 just have a single self test: ``` $ ./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep "\s[01]\s[0-9]"|cut -f 1,2 blackberry-es10 1 Clipperz 1 dmd5 1 fde 1 FormSpring 1 keystore 1 lp 1 LUKS 1 osc 1 ``` But for the other formats, this might help: ``` $ ./john --list=format-tests |cut -f 4 |LC_ALL=C sort -u > passwords.test Test scrypt 1: plaintext contains line feed Test scrypt 1: ciphertext contains line feed or separator character ' ' (bleeding-jumbo)run $ wc -l passwords.test 537 passwords.test $ ./john --incremental=upper --min-length=7 --max-length=7 --stdout | head -n 1000000 >> passwords.test Press 'q' or Ctrl-C to abort, almost any other key for status $ ./unique passwords.u < passwords.test Total lines read 1000537 Unique lines written 1000537 ``` Apparently, none of the self test passwords is among the first 1000000 candidates generated by my incremental mode run. So we can just drop the top 537 lines, to get a suitable sample input file: ``` $ tail -n +538 passwords.u > test.lst ``` And now let's collect the password hashes: ``` $ for f in `./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep -v "\s[01]\s[0-9]"|cut -f 1`; do ./john --format=$f --list=format-tests |cut -f 2,3| tr '\t' ':' > hashes.$f; done ``` Finally, a test run for each individual hash: ``` $ for f in $(./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep -v "\s[01]\s[0-9]"|cut -f 1); do echo "$f"; for u in $(seq 0 $(./john --format=$f --list=format-details |cut -f 6)); do echo "$f $u "; time ./john hashes.$f --format=$f --users=$u --wordlist=test.lst --session=$f-$u --pot=dummy.pot > stdout-$f-$u.txt 2> stderr-$f-$u.txt; done; done descrypt descrypt 0 real 0m0.275s user 0m1.043s sys 0m0.016s descrypt 1 real 0m0.201s user 0m0.967s sys 0m0.011s descrypt 2 real 0m0.201s user 0m0.970s sys 0m0.009s descrypt 3 real 0m0.212s user 0m0.970s sys 0m0.011s descrypt 4 real 0m0.203s user 0m0.984s sys 0m0.008s descrypt 5 real 0m0.062s user 0m0.058s sys 0m0.004s bsdicrypt bsdicrypt 0 real 0m2.471s user 0m18.750s sys 0m0.013s bsdicrypt 1 real 0m2.574s user 0m19.715s sys 0m0.007s bsdicrypt 2 real 0m2.638s user 0m20.305s sys 0m0.006s bsdicrypt 3 real 0m2.694s user 0m20.691s sys 0m0.015s bsdicrypt 4 real 0m2.840s user 0m20.951s sys 0m0.030s bsdicrypt 5 real 0m2.874s user 0m21.296s sys 0m0.026s bsdicrypt 6 real 0m2.798s user 0m21.571s sys 0m0.013s bsdicrypt 7 real 0m2.830s user 0m21.766s sys 0m0.014s bsdicrypt 8 real 0m2.946s user 0m21.813s sys 0m0.017s bsdicrypt 9 real 0m2.876s user 0m22.155s sys 0m0.015s bsdicrypt 10 real 0m2.960s user 0m22.744s sys 0m0.010s bsdicrypt 11 real 0m2.938s user 0m22.504s sys 0m0.013s bsdicrypt 12 real 0m0.079s user 0m0.074s sys 0m0.006s ... ``` Then, you can compare the run time of individual hashes (e.g., from the last line of the log files). And if the ratio of fastest vs. slowest run justifies reporting a cost parameter, look into the format and find out what causes the different run time... Some more scripting is required to automate this. (And may be we need to look into formats that lack some important self tests before doing this.) (Of course, you'd need a system which doesn't throttle the CPU clock rate due to temperature, so my laptop isn't suitable.) Not sure whether we should aim to complete this before the next jumbo release...
bsakaguchi 2026-10-14 03:10:18 +07:00
Author
Owner

@jfoug commented on GitHub (Dec 14, 2014):

Not sure whether we should aim to complete this before the next jumbo release...

No. Tunable costs is a bell that should not hold up any jumbo. Yes, the more that get 'properly' put in there ,the better. BUT it adds little to john per-se. Yes, it does add, BUT it really is pretty advanced, and someone advanced enough to know WHY to use it, probably already is smart enough to group hashes out anyway.

<!-- gh-comment-id:66917318 --> @jfoug commented on GitHub (Dec 14, 2014): > Not sure whether we should aim to complete this before the next jumbo release... No. Tunable costs is a bell that should not hold up any jumbo. Yes, the more that get 'properly' put in there ,the better. BUT it adds little to john per-se. Yes, it does add, BUT it really is pretty advanced, and someone advanced enough to know WHY to use it, probably already is smart enough to group hashes out anyway.
Author
Owner

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

Note that some formats (eg. RAR and 7z) get very different speed for different password lengths, so the length of the test vectors' cleartexts may falsely indicate there is some other cost involved.

<!-- gh-comment-id:66947657 --> @magnumripper commented on GitHub (Dec 15, 2014): Note that some formats (eg. RAR and 7z) get very different speed for different password lengths, so the length of the test vectors' cleartexts may falsely indicate there is some other cost involved.
Author
Owner

@frank-dittrich commented on GitHub (Dec 15, 2014):

But doesn't --test use various passwords against these hashes, so that the length of the matching password shouldn't matter? (I admit I never really looked into the --test code.)

<!-- gh-comment-id:66950089 --> @frank-dittrich commented on GitHub (Dec 15, 2014): But doesn't --test use various passwords against these hashes, so that the length of the matching password shouldn't matter? (I admit I never really looked into the --test code.)
Author
Owner

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

No, the benchmark will use either the correct cleartexts, or cripple them if we indicated it's needed (the latter is a jumbo feature for formats that perform much worse while processing a positive). But even when crippled, length is same as original.

<!-- gh-comment-id:66967041 --> @magnumripper commented on GitHub (Dec 15, 2014): No, the benchmark will use either the correct cleartexts, or cripple them if we indicated it's needed (the latter is a jumbo feature for formats that perform much worse while processing a positive). But even when crippled, length is same as original.
Author
Owner

@frank-dittrich commented on GitHub (Dec 15, 2014):

OK, so I learned something new.
In my test run, however,

for f in $(./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep -v "\s[01]\s[0-9]"|cut -f 1); do echo "$f"; for u in $(seq 0 $(./john --format=$f --list=format-details |cut -f 6)); do echo "$f $u "; time ./john hashes.$f --format=$f --users=$u --wordlist=test.lst --session=$f-$u --pot=dummy.pot > stdout-$f-$u.txt 2> stderr-$f-$u.txt; done; done

I'll use the same set of password candidates against all the individual hashes, avoiding all the passwords which would crack any of the test hashes.
So it should not matter for rar, 7z, etc.
But we might find formats where the run time depends on the length of the salt, on the variant of the algorithm, etc.

<!-- gh-comment-id:66968169 --> @frank-dittrich commented on GitHub (Dec 15, 2014): OK, so I learned something new. In my test run, however, ``` for f in $(./john --list=format-details |cut -f 1,6,12,13|grep '\s$'|grep -v "\s0\s$" |grep -v "\s[01]\s[0-9]"|cut -f 1); do echo "$f"; for u in $(seq 0 $(./john --format=$f --list=format-details |cut -f 6)); do echo "$f $u "; time ./john hashes.$f --format=$f --users=$u --wordlist=test.lst --session=$f-$u --pot=dummy.pot > stdout-$f-$u.txt 2> stderr-$f-$u.txt; done; done ``` I'll use the same set of password candidates against all the individual hashes, avoiding all the passwords which would crack any of the test hashes. So it should not matter for rar, 7z, etc. But we might find formats where the run time depends on the length of the salt, on the variant of the algorithm, etc.
Author
Owner

@solardiz commented on GitHub (May 25, 2024):

Skimming the comments from December 2014, this was an attempt by Frank to automatically identify formats missing tunable costs through benchmarking them. magnum pointed out that for some formats performance varies with password length, which we shouldn't treat as a tunable cost.

Despite this issue's title, it doesn't appear to list specific examples of "formats which don't report tunable costs even if they should..."

We probably still do have formats that need tunable costs added, but the comments on this issue look pretty useless for that now. Closing.

<!-- gh-comment-id:2131303999 --> @solardiz commented on GitHub (May 25, 2024): Skimming the comments from December 2014, this was an attempt by Frank to automatically identify formats missing tunable costs through benchmarking them. magnum pointed out that for some formats performance varies with password length, which we shouldn't treat as a tunable cost. Despite this issue's title, it doesn't appear to list specific examples of "formats which don't report tunable costs even if they should..." We probably still do have formats that need tunable costs added, but the comments on this issue look pretty useless for that now. Closing.
Author
Owner

@solardiz commented on GitHub (May 25, 2024):

A more recent replacement for this issue is #3910.

<!-- gh-comment-id:2131694256 --> @solardiz commented on GitHub (May 25, 2024): A more recent replacement for this issue is #3910.
bsakaguchi changed title from [GH-ISSUE #880] Salted formats which don't report tunable costs even if they should... to [GH-ISSUE #880] Salted formats which don't report tunable costs even if they should... 2026-10-14 04:20:34 +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#486
No description provided.