[GH-ISSUE #989] BFegg format error in test suite #589

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

Originally created by @frank-dittrich on GitHub (Jan 2, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/989

(master)test $ ./jtrts.pl -type BFegg
-------------------------------------------------------------------------------
- JtR-TestSuite (jtrts). Version 1.13, Dec 21, 2014.  By, Jim Fougeron & others
- Testing:  John the Ripper password cracker, version 1.8.0.2-jumbo-1-bleeding_omp [linux-gnu 64-bit AVX-autoconf]
--------------------------------------------------------------------------------

John Jumbo build detected.

form=BFegg                        guesses: 1500 0:00:00:00 DONE  [PASSED]
.pot CHK:BFegg                    guesses: 1499 -show=1499 0:00:00:00 DONE : Expected count(s) (1500)  [!!!FAILED!!!]

Some tests had Errors. Performed 1 tests.  1 errors reprocessing the .POT files
Time used was 2 seconds
Originally created by @frank-dittrich on GitHub (Jan 2, 2015). Original GitHub issue: https://github.com/openwall/john/issues/989 ``` (master)test $ ./jtrts.pl -type BFegg ------------------------------------------------------------------------------- - JtR-TestSuite (jtrts). Version 1.13, Dec 21, 2014. By, Jim Fougeron & others - Testing: John the Ripper password cracker, version 1.8.0.2-jumbo-1-bleeding_omp [linux-gnu 64-bit AVX-autoconf] -------------------------------------------------------------------------------- John Jumbo build detected. form=BFegg guesses: 1500 0:00:00:00 DONE [PASSED] .pot CHK:BFegg guesses: 1499 -show=1499 0:00:00:00 DONE : Expected count(s) (1500) [!!!FAILED!!!] Some tests had Errors. Performed 1 tests. 1 errors reprocessing the .POT files Time used was 2 seconds ```
bsakaguchi 2026-10-14 03:14:30 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@jfoug commented on GitHub (Jan 2, 2015):

Here is what I see, this is after a hand run, putting the data into ./tst.pot

$ head -15 tst.pot
+4v2EJ.PCv0o1:Skippin▒ an▒*
+wMI371BCXwU.:Skipping and*
+47JCQ/IMWDS/:Bert$Er▒IE
+ghuwO0VV2bL0:Bert$ErnIE
+2ZCji1tr1Ru/:bert*ernie
+0bVV8/o4eF40:late*night
+C/.8o.Wuph9.:
+N.qSl1ccnIA/:
+V6ZOx0rVGWT0:1
+vGjzQ0zcBbK/:password
+o6oJh1RHK.c1:test
+9SNtB0YKl0M1:late*ni▒h▒
+4TLS6/5.KHe1:hello
+KWpVH.S6Q4e/:Skipping and& Dipping
+.QN6k.Zodje.:!!!!!!!!!

Not, the line +C/.8o.Wuph9: then the following line. (N.qSI1ccnIA/ line). The N.qSI1.. is for a single space character. The other (the C/.8o....) is actually the password for querty, BUT for some reason, querty is not being written into the .pot file. Guess I will have to see if VC has this same bug (I hope so).

<!-- gh-comment-id:68564891 --> @jfoug commented on GitHub (Jan 2, 2015): Here is what I see, this is after a hand run, putting the data into ./tst.pot ``` $ head -15 tst.pot +4v2EJ.PCv0o1:Skippin▒ an▒* +wMI371BCXwU.:Skipping and* +47JCQ/IMWDS/:Bert$Er▒IE +ghuwO0VV2bL0:Bert$ErnIE +2ZCji1tr1Ru/:bert*ernie +0bVV8/o4eF40:late*night +C/.8o.Wuph9.: +N.qSl1ccnIA/: +V6ZOx0rVGWT0:1 +vGjzQ0zcBbK/:password +o6oJh1RHK.c1:test +9SNtB0YKl0M1:late*ni▒h▒ +4TLS6/5.KHe1:hello +KWpVH.S6Q4e/:Skipping and& Dipping +.QN6k.Zodje.:!!!!!!!!! ``` Not, the line +C/.8o.Wuph9: then the following line. (N.qSI1ccnIA/ line). The N.qSI1.. is for a single space character. The other (the C/.8o....) is actually the password for querty, BUT for some reason, querty is not being written into the .pot file. Guess I will have to see if VC has this same bug (I hope so).
Author
Owner

@frank-dittrich commented on GitHub (Jan 2, 2015):

with commit c7e2bd6, BFegg still works.

I thought the commit adding long passwords had triggered the bug, but git bisect points to

01c00a0f7faf9e06b82d82f526f9b44738228080 is the first bad commit
commit 01c00a0f7faf9e06b82d82f526f9b44738228080
Author: jfoug <jfoug@cox.net>
Date:   Thu Jan 1 21:48:46 2015 -0600

    added many dynamic types from dynamic.conf and dynamic_flat_sse_formats.conf

as the first bad commit.

<!-- gh-comment-id:68567540 --> @frank-dittrich commented on GitHub (Jan 2, 2015): with commit `c7e2bd6`, BFegg still works. I thought the commit adding long passwords had triggered the bug, but `git bisect` points to ``` 01c00a0f7faf9e06b82d82f526f9b44738228080 is the first bad commit commit 01c00a0f7faf9e06b82d82f526f9b44738228080 Author: jfoug <jfoug@cox.net> Date: Thu Jan 1 21:48:46 2015 -0600 added many dynamic types from dynamic.conf and dynamic_flat_sse_formats.conf ``` as the first bad commit.
Author
Owner

@jfoug commented on GitHub (Jan 2, 2015):

VC finds it just fine. NOTE, the difference in the .pot file between a cygwin64 build (or Unbuntu build), is that line: +C/.8o.Wuph9.: is moved up in the file. In the VC build (that works), that line is at #26, which is the element itself. Other than this ONE line, the rest of the entire .pot file is the same.

<!-- gh-comment-id:68567569 --> @jfoug commented on GitHub (Jan 2, 2015): VC finds it just fine. NOTE, the difference in the .pot file between a cygwin64 build (or Unbuntu build), is that line: +C/.8o.Wuph9.: is moved up in the file. In the VC build (that works), that line is at `#26`, which is the element itself. Other than this ONE line, the rest of the entire .pot file is the same.
Author
Owner

@jfoug commented on GitHub (Jan 2, 2015):

But this has nothing to do with jtrts. I am not even using that tool. I am doing all of this from command line. JtrTS is giving 100% valid results. On my cygwin/ubuntu runs, there ARE 1499 valid .pot lines, and 1 invalid one.

So we need to look at commits around this time, but in the jumbo branch, not jtrts.

<!-- gh-comment-id:68567865 --> @jfoug commented on GitHub (Jan 2, 2015): But this has nothing to do with jtrts. I am not even using that tool. I am doing all of this from command line. JtrTS is giving 100% valid results. On my cygwin/ubuntu runs, there ARE 1499 valid .pot lines, and 1 invalid one. So we need to look at commits around this time, but in the jumbo branch, not jtrts.
Author
Owner

@frank-dittrich commented on GitHub (Jan 2, 2015):

I don't yet see how that commit 01c00a0f7faf9e06b82d82f526f9b44738228080 could break the BFegg test, but
after a git revert 01c00a0f7faf9e06b82d82f526f9b44738228080, the BFegg format test passes!

<!-- gh-comment-id:68568563 --> @frank-dittrich commented on GitHub (Jan 2, 2015): I don't yet see how that commit 01c00a0f7faf9e06b82d82f526f9b44738228080 could break the BFegg test, but after a `git revert 01c00a0f7faf9e06b82d82f526f9b44738228080`, the BFegg format test passes!
Author
Owner

@frank-dittrich commented on GitHub (Jan 2, 2015):

I bet it is the pw.dic change in commit 01c00a0f7faf9e06b82d82f526f9b44738228080 that broke the BFegg test.

<!-- gh-comment-id:68568808 --> @frank-dittrich commented on GitHub (Jan 2, 2015): I bet it is the pw.dic change in commit 01c00a0f7faf9e06b82d82f526f9b44738228080 that broke the BFegg test.
Author
Owner

@jfoug commented on GitHub (Jan 2, 2015):

I bet that is 100% correct. There also were some longer passwords added. We may have some overwrite issue in bf egg that this has tripped. I will have to look at this, sometime later.

This points out that we may want to modify pw.dic in other ways to try and flush out other bugs. These are often 1 offs, and may greatly depend upon order of input file, length of 1 line and other lines either just in front or just after.

This was similar to the bug I found in the flat SIMD dynamic code. There were 2 formats which each had the same password 'missed'. It happened to be something that was triggered by the 64 bit SIMD, and how the self test stuff 'prepared' the data. Once it was setup, that password (or anything that specific length) would not be found.

But I need to bail out now, for a while. I will look at this one later, since I think you have found the initial cause of seeing this bug (the modification to the dictionary file).

<!-- gh-comment-id:68568939 --> @jfoug commented on GitHub (Jan 2, 2015): I bet that is 100% correct. There also were some longer passwords added. We may have some overwrite issue in bf egg that this has tripped. I will have to look at this, sometime later. This points out that we may want to modify pw.dic in other ways to try and flush out other bugs. These are often 1 offs, and may greatly depend upon order of input file, length of 1 line and other lines either just in front or just after. This was similar to the bug I found in the flat SIMD dynamic code. There were 2 formats which each had the same password 'missed'. It happened to be something that was triggered by the 64 bit SIMD, and how the self test stuff 'prepared' the data. Once it was setup, that password (or anything that specific length) would not be found. But I need to bail out now, for a while. I will look at this one later, since I think you have found the initial cause of seeing this bug (the modification to the dictionary file).
Author
Owner

@frank-dittrich commented on GitHub (Jan 2, 2015):

But it didn't cause any asan error or MemDbg_Validate level 0 error.

<!-- gh-comment-id:68569485 --> @frank-dittrich commented on GitHub (Jan 2, 2015): But it didn't cause any asan error or MemDbg_Validate level 0 error.
Author
Owner

@jfoug commented on GitHub (Jan 3, 2015):

If things are overwritten WITHIN an array of arrays, i.e. like when we allocate things like our array of buffers for plaintext,within the format, then there would be nothing to catch that. The external 'array', is nothing more than something conceptual to the programming language. The actual buffer allocated is just a flat space of data, that is perfectly valid to write all over the place. I have an idea that (or something like that), is what is getting trampled on. It may just be one of those bugs that single stepping, would find quickly. Something that does not jump out.

Unfortunately, VC is not having this problem :(((((( or I could probably find it in minutes, by simply stepping code, and watching results. Without that, you almost have to single step within your head, figure out things that you 'should' be able to make assertions for, before a piece of code is executed and an assertion of what should be after that code is done, and then start using trace statements to check those assertions. Very slow and time consuming, but it is about the only way I know without knowing better how to debug well on unix.

<!-- gh-comment-id:68593149 --> @jfoug commented on GitHub (Jan 3, 2015): If things are overwritten WITHIN an array of arrays, i.e. like when we allocate things like our array of buffers for plaintext,within the format, then there would be nothing to catch that. The external 'array', is nothing more than something conceptual to the programming language. The actual buffer allocated is just a flat space of data, that is perfectly valid to write all over the place. I have an idea that (or something like that), is what is getting trampled on. It may just be one of those bugs that single stepping, would find quickly. Something that does not jump out. Unfortunately, VC is not having this problem :(((((( or I could probably find it in minutes, by simply stepping code, and watching results. Without that, you almost have to single step within your head, figure out things that you 'should' be able to make assertions for, before a piece of code is executed and an assertion of what should be after that code is done, and then start using trace statements to check those assertions. Very slow and time consuming, but it is about the only way I know without knowing better how to debug well on unix.
Author
Owner

@magnumripper commented on GitHub (Jan 3, 2015):

FWIW there's a GUI frontend to gdb called ddd that makes single stepping a lot less painful than with a pure text interface.

<!-- gh-comment-id:68594917 --> @magnumripper commented on GitHub (Jan 3, 2015): FWIW there's a GUI frontend to gdb called ddd that makes single stepping a lot less painful than with a pure text interface.
Author
Owner

@frank-dittrich commented on GitHub (Jan 3, 2015):

if you want to use gdb, you need to adjust your ~/.gdbinit to define aliases and macros so that you can single step and display all the info you need with a simple alias ...

<!-- gh-comment-id:68598694 --> @frank-dittrich commented on GitHub (Jan 3, 2015): if you want to use gdb, you need to adjust your ~/.gdbinit to define aliases and macros so that you can single step and display all the info you need with a simple alias ...
Author
Owner

@jfoug commented on GitHub (Jan 4, 2015):

This bug has to do with this format not working with 0 length password. I just have to figure out how to get it to work properly.

<!-- gh-comment-id:68635942 --> @jfoug commented on GitHub (Jan 4, 2015): This bug has to do with this format not working with 0 length password. I just have to figure out how to get it to work properly.
Author
Owner

@jfoug commented on GitHub (Jan 4, 2015):

Fixed: 736c18d

<!-- gh-comment-id:68636190 --> @jfoug commented on GitHub (Jan 4, 2015): Fixed: 736c18d
Author
Owner

@magnumripper commented on GitHub (Jan 4, 2015):

Maybe the real application does not even allow a zero length?

<!-- gh-comment-id:68637017 --> @magnumripper commented on GitHub (Jan 4, 2015): Maybe the real application does not even allow a zero length?
Author
Owner

@jfoug commented on GitHub (Jan 4, 2015):

It does not, BUT a word list might have 0 length lines in there. That is why we have to 'work around' those issues, within the format itself. I do not thin we have a minword-length like we have a maxword length in the format structure.

<!-- gh-comment-id:68638245 --> @jfoug commented on GitHub (Jan 4, 2015): It does not, BUT a word list might have 0 length lines in there. That is why we have to 'work around' those issues, within the format itself. I do not thin we have a minword-length like we have a maxword length in the format structure.
Author
Owner

@magnumripper commented on GitHub (Jan 4, 2015):

We do (not in the format struct but as an option). We could force min length to 1 just as we force it to 8 for WPA-PSK. It's line 1329 in john.c

<!-- gh-comment-id:68641152 --> @magnumripper commented on GitHub (Jan 4, 2015): We do (not in the format struct but as an option). We could force min length to 1 just as we force it to 8 for WPA-PSK. It's line 1329 in john.c
Author
Owner

@frank-dittrich commented on GitHub (Jan 4, 2015):

That hack is ugly enough. I wouldn't want to add formats with min. length 1 here.

<!-- gh-comment-id:68641254 --> @frank-dittrich commented on GitHub (Jan 4, 2015): That hack is ugly enough. I wouldn't want to add formats with min. length 1 here.
Author
Owner

@jfoug commented on GitHub (Jan 4, 2015):

But the hack added to BFegg is also an ugly hack. But it 'is' only contained within that one format.

Are there other 'min-length' password hashes (I think so). It might be good to look at a less hackish way to do this in general. Ahh, I see you did, in #996

<!-- gh-comment-id:68642759 --> @jfoug commented on GitHub (Jan 4, 2015): But the hack added to BFegg is also an ugly hack. But it 'is' only contained within that one format. Are there other 'min-length' password hashes (I think so). It might be good to look at a less hackish way to do this in general. Ahh, I see you did, in #996
Author
Owner

@frank-dittrich commented on GitHub (Jan 4, 2015):

SAP also has min length, but it removes trailing spaces before calculating the min length. So, SAP needs a format specific solution anyway.

<!-- gh-comment-id:68642882 --> @frank-dittrich commented on GitHub (Jan 4, 2015): SAP also has min length, but it removes trailing spaces before calculating the min length. So, SAP needs a format specific solution anyway.
Author
Owner

@jfoug commented on GitHub (Jan 4, 2015):

Yes, I agree there. There certainly will be ' ' (2 spaces) passwords in wordlists, so SAP has to also deal with it internally in the format. However, it still could have a min length of 1 set for the format, in the fmt-structure. You would at least assure the format that there is 'something' there, even if it ends up being 0 length string after trimming.

I think there are others (bcrypts??? / scrypts??) which do not work with zero length strings.

<!-- gh-comment-id:68642994 --> @jfoug commented on GitHub (Jan 4, 2015): Yes, I agree there. There certainly will be ' ' (2 spaces) passwords in wordlists, so SAP has to also deal with it internally in the format. However, it still could have a min length of 1 set for the format, in the fmt-structure. You would at least assure the format that there is 'something' there, even if it ends up being 0 length string after trimming. I think there are others (bcrypts??? / scrypts??) which do not work with zero length strings.
Author
Owner

@magnumripper commented on GitHub (Jan 6, 2015):

Workaround reverted and real min-length implemented in a916df7

<!-- gh-comment-id:68956357 --> @magnumripper commented on GitHub (Jan 6, 2015): Workaround reverted and real min-length implemented in a916df7
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#589
No description provided.