mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2255] gpg2john segfaults with fuzzed input #1511
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#1511
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 @frank-dittrich on GitHub (Sep 2, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2255
Originally assigned to: @frank-dittrich on GitHub.
This is the contents of fail_gpg2john-1.hex:
(no newline, in case it matters for base64conf)
Similar segfaults with these files converted back from hex to raw:
@frank-dittrich commented on GitHub (Sep 2, 2016):
Three more files which cause gpg2john to segfault:
All the above found using american fuzzy lop, in less than 1 hour of fuzzing gpg2john using afl.
Alf produced 103 crashes so far, and thinks these 6 are unique segfaults.
I found at least 2 different back traces.
This is the 2nd backtrace:
Afl is still running, so I guess more problems might be found.
@magnumripper commented on GitHub (Sep 3, 2016):
Any issues that involve fuzzed / purposely b0rken input should state so in the title please.
@frank-dittrich commented on GitHub (Sep 3, 2016):
While most of the other segfaults afl found so far result in the same two back traces I already posted, this one
will result in
(after converting from hex to raw)
@frank-dittrich commented on GitHub (Sep 3, 2016):
afl also found several hangs.
When I test such an input running gpg2john from gdb and then killing gpg2john, this is the back trace:
@jfoug commented on GitHub (Sep 16, 2016):
This problem appears to mostly stem from using int vs an unsigned (like size_t) type value. Thus, if (len > sizeof(buf)) would not be triggered if len was < 0.
@frank-dittrich commented on GitHub (Sep 16, 2016):
@jfoug looks like none of the crashes can be reproduced anymore.
But the input files identified as "hangs" still cause gpg2john to somehow run really long, if not virtually forever.
When cracking fuzzed hashes, I would expect something like that if the fuzzer generates ridiculous iteration counts etc. But is it to be expected that gpg2john takes forever processing a single input file of just 3 bytes length? (The 3 bytes are
<A0><E8>^C.)@jfoug commented on GitHub (Sep 16, 2016):
When I ran that file, I instantly got this error message:
Then when run without bzip2, I get this (instantly again)
@frank-dittrich commented on GitHub (Sep 17, 2016):
That's strange.
I get the hangs on my ubuntu system which I've upgraded from 14.04 to 16.04.
Will have to try other systems.
Here's the list of hangs I got with afl.
With
xxd -ryou should be able to convert each file to raw.@frank-dittrich commented on GitHub (Sep 17, 2016):
This is from testing the first file (id:000000*) and then killing john:
@frank-dittrich commented on GitHub (Sep 17, 2016):
Same on my fedora 24 system:
... and gpg2john hangs
@jfoug commented on GitHub (Sep 19, 2016):
Ok, I can get things to hang if the bz2 lib is installed (but not without it). Should be an easy 'fix'
@jfoug commented on GitHub (Sep 19, 2016):
@frank-dittrich please retest after
bd56033The code got into an infinite loop on truncated data (bz2 compressed). bz.avail_in was 0. Size found was 0 and plugged into bz.avail_in and it would continue that way. Now, if there is no data left, we simply break out of the decompression returning failure.