mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #477] gpg2john outputs some gecos data matched with wrong key data #191
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#191
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @magnumripper on GitHub (Jan 9, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/477
Originally assigned to: @kholia on GitHub.
As discussed in https://github.com/magnumripper/JohnTheRipper/pull/442#issuecomment-31308369
@jfoug commented on GitHub (Nov 24, 2014):
Can we get some examples please? I did a little testing, and saw no problems, BUT this format has SOOOOOOO many subtypes, that a bug like this can likely be buried down deep in a single subclass (or 2).
@magnumripper commented on GitHub (Nov 24, 2014):
Just create several keys in one file and then dump it
It lists name2 (comment2 mail2 etc) twice but never name3 etc.
@jfoug commented on GitHub (Nov 25, 2014):
Ok, I followed instructions exactly as above to create a key-ring with the same 3 keys (I thought 3). I added a little debugging code, so that right before the (*tag_func[tag])(len) function call is done, I output some information (the tag, the len, the offset in the file (I wrote code for this), and a text string of the tag_func being called.). Here is the output. To me, it looks like we really need to detect a few thing. We need to detect the start of a unique block, and the start of the next block (while processing). When we detect the start of a new block, we print out whatever we had saved up. We then clean all buffers, for the next block. Then at the end of the file, we also dump out what we have. I do not think this is being done. I actually think the first buffer (the one starting with 666aaaa is actually the 2nd hash in the file, not the first) I need to dig in more and figure this thing out.
@jfoug commented on GitHub (Nov 25, 2014):
Ok, I created a new secring, but gave a PW to the first one (the RSA). Here is the output. I am pretty sure I know the problem now. The code dumps out the key when it sees it, while is should wait until it has the key AND the user_id_packet. The first packet has nothing. The 2nd one gets the right data (I assume that the first 2 packets are for the same block??, the RSA). Then the 3rd block (which is for the 2nd but it still gets the first comment (the 2nd user record not seen yet). Then the 4th gets the 2nd, and the 5th gets the 2nd (again, the 3rd user/comment record not seen yet).
I think I can get this fixed. I may still not have down exactly what is going on. I do not see why there are 5 records here (I would think 3).
@magnumripper commented on GitHub (Nov 25, 2014):
Note what Dhiru wrote in https://github.com/magnumripper/JohnTheRipper/pull/442#issuecomment-31337004 : I think things may come in any order. Maybe this is just what you already saw.
@jfoug commented on GitHub (Nov 25, 2014):
I have a version ready. NOTE, this still prints subkeys. Should that be removed also? That would be easy, and I will give a command line switch for it.
To get the right gecos data with the key, what I had to do was NOT print out key when it is read. What I do is use a static string. When I find a key IF that static string contains data, I write out what the prior key was, with the current login/gecos data. I then write the current key into this static string (for the next key). Also, when all data is done, I remake the login/gecos data, and print out the stored key).
I have also added a -d switch (for debugging output). The only debugging is listing what type blocks were found. The other printf() stuff, I changed to fprintf(stderr..) We probably should preceed all of those with an if (gpg_dbg) so that the fprintf stuff does not show up except in debug mode.
I also fixed the filename(s) Only 1 file was being processed before, now multiple are being processed.
I also made a change to john.c, so that I can 'override' behavior of the john exe, vs using the renamed crap. This help me greatly in VC GUI debugging. Currently it is wrapped with #ifdef _MSC_VER so that it is VC specific, BUT it could be useful for all.
2fee9ee23a130e(changes to john.c)@jfoug commented on GitHub (Nov 25, 2014):
This has been left open for now, but I think it is closed. NOTE, I notice that subkeys also print, and saw that on #442 this is also an issue. I have not made changes to mute them, but easily can.
I need @magnumripper and @kholia to validate that the changes I have made are complete, and handle this issue, prior to it getting the bug closed.
@jfoug commented on GitHub (Nov 25, 2014):
Subkey muting added
0bfe751There is now a -S argument that allows subkeys to still be output.@magnumripper commented on GitHub (Nov 25, 2014):
Excellent! 👍
@jfoug commented on GitHub (Nov 25, 2014):
Again (as mentioned in a commit message), I am following this assumption:
Key1
ID1
Subkey1 (muted)
Key2
ID2
[SubKey2]
Key3
ID3
If we see
ID1
Key1
ID2
Key2
then the logic as I have it will fail. It would associate ID2 to Key1, and then ID2 to Key2 upon program exit. What I do is each time I see a new 'key', I output the PRIOR key. So the first one has no prior key, it does not output. After outputting, I blank out the saved key. Then if this key is not a subkey, I write the key data to a temp var. Then upon end of file, I also output (if there is a key set).
This is similar to how the login data was stored, when one of the ID blocks was hit. This delayed outputting of the key, appears to match proper login ID and key, waiting for a new key to flush out what has been stored.
I did a test in the pgp-70-flavors, and I get 30 hashes. The older crackme.all ONLY gets 25 hashes loaded, but all 25 are contained within the 30 that get loaded with the new code.
So, there are 40 hashes that do NOT load. Again, I do not know the format well enough to know if it is supposed to be that way, OR if this simply is our format not handling all these types properly.
@jfoug commented on GitHub (Nov 25, 2014):
@magnumripper if you are OK with the changes as presented, then this bug can be closed. From the testing I have been able to do, it appears to be working properly now.
@magnumripper commented on GitHub (Nov 25, 2014):
aye