mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2005] ASan: heap-buffer-overflow for agilekeychain format when fuzzing #1347
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#1347
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 (Jan 22, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2005
Originally assigned to: @frank-dittrich on GitHub.
This is with scrypt format disabled due to https://github.com/magnumripper/JohnTheRipper/issues/2003
@magnumripper commented on GitHub (Jan 23, 2016):
Do we know exactly what --fuzz option did, that triggered this? If yes, please include that. If no, let's ditch the fuzz option.
@frank-dittrich commented on GitHub (Jan 23, 2016):
Yes, you can recreate the fuzzed data with
The screen output of --fuzz-dump is confusing, since --fuzz-dump isn't really fuzzing the format.
Instead, it is producing a file pwfile.agilekeychain with fuzzed hashes, and you can then run that format using this file with fuzzed hashes.
(I think the screen output for --fuzz-dump should be changed. I'll look into that.)
Unfortunately, when fuzzing agilekeychain as a single format, you don't get that ASan error.
Instead, after running for more than 20 minutes, it gets killed (due to hitting ulimit; I noticed that top reported several gigabytes RES when john ran for a while.
So, in this case, the --fuzz-dump output might be somewhat less useful.
BTW, I verified that the pwfile. for a particular format is always the same (for a given build).
For https://github.com/magnumripper/JohnTheRipper/issues/2003, I've done that test.
(Because I was afraid that --fuzz wouldn't produce the same data when running against an individual format.)
So, it doesn't matter whether you specify --format= or not (except that you might not have enough disk space to store the fuzzed hashes of all formats.
Just now I checked out commit
c18330124c(see issue https://github.com/magnumripper/JohnTheRipper/issues/2004, meanwhile fixed by Jim), and tested this procedure:So the file extension doesn't contain the full format string.
May be we should try to fix that.
The top entries of the stack
are exactly the same as those when running --fuzz.
@frank-dittrich commented on GitHub (Jan 23, 2016):
Of course, you can also use
So, there's no need to try any real cracking mode on that file.
@jfoug commented on GitHub (Jan 23, 2016):
The fuzz option has it's purpose. After I reverted that change so that --fuzz-dump does not kill the files, you can --fuzz until a problem, then get the raw file for that format, and start finding the exact line that caused the crash or ASAN fail. --fuzz is simply a summation in C code of all the fuzzing perl scripts used by many folks to ferret out overwrites and other crap.
@jfoug commented on GitHub (Jan 23, 2016):
Note, we probably should change --fuzz-dump to ONLY work if a single --format= is used.
@frank-dittrich commented on GitHub (Jan 23, 2016):
Requiring --format for --fuzz-dump is a good idea, but may be we can still allow generic format specifications.
For now, I at least adjusted screen output for --fuzz-dump, to avoid the kind of confusion that made me open issue https://github.com/magnumripper/JohnTheRipper/issues/1969
@frank-dittrich commented on GitHub (Jan 23, 2016):
With that amount of data, it is no surprise that john --fuzz fails:
memory mapping failed, but not because that file doesn't exist.
I'll see whether I can get agilekeychain fuzzing to fail with a smaller sample.
@frank-dittrich commented on GitHub (Jan 23, 2016):
@magnumripper commented on GitHub (Sep 19, 2016):
Perhaps time to re-test this issue after all recent fixes in format and in core?
@frank-dittrich commented on GitHub (Sep 19, 2016):
@magnumripper I will not be able to re-test for the next 2 weeks, but after those two weeks, I can test this.
BTW: I might somehow adjust --fuzz-fump or make it configurable, because (after the recent fuzz-dump changes, it generates more than 50 GB of test data for just for agilekeychain format.
This is insane.
@frank-dittrich commented on GitHub (Oct 13, 2016):
With
1.8.0-jumbo-1-5362-g2207c2c, I repeated the agilekeychain test:Unfortunately, john was running out of memory. (To be expected if there are too many "valid" hashes in the fuzzed data.)
I'll try to split that huge
pwfile.agilekeychaininto smaller chunks, and process test cases of reasonable size, but that might take a while.@kholia commented on GitHub (Mar 8, 2017):
@frank-dittrich Is this bug a practical one which requires fixing? There has been no activity on this bug for a while. Can this bug be closed safely?
@frank-dittrich commented on GitHub (Mar 8, 2017):
I think it needs fixing if it still exists.
I'll try to reproduce and get a small test case over the weekend.
@magnumripper commented on GitHub (Dec 15, 2018):
Closing because it's a shame people love to fuzz but hate to help fixing bugs
@roycewilliams commented on GitHub (Dec 15, 2018):
I see your point, but this doesn't feel right. Does it matter where the bug came from, if it's a real bug?
@ghost commented on GitHub (Dec 15, 2018):
I agree with magnum:
a file pwfile.agilekeychain with fuzzed hashes;And:
Low Priority - It have a tendency to become high priority if enough of the users complain.
WontFix - Covers all the reasons we chose to close the bug without taking action.
@solardiz commented on GitHub (Dec 15, 2018):
If we only care about memory corruption from real-world usage and not from malicious files, we should very explicitly state so in the documentation, in some place like a text file called
INSECURITYstating that JtR isn't to be used on untrusted input and should be run with the lowest privileges necessary (which is a good idea anyway). That's another task to take care of before the next release.It's unfortunate that such a policy of ours (stemming from code complexity, lower than ideal quality, and lack of resources) is sort of incompatible with Kali's policy of running everything as root.
@roycewilliams commented on GitHub (Dec 15, 2018):
I see your (@claudioandre-br)'s point as well. I'm sure that many projects treat input hashes as trusted data, not just JtR.
But I also personally think that projects should think hard about that. As projects get more diverse, get called by other projects, provide APIs, get wrapped in web and database interfaces ... an entire class of future problems may be avoided by robustly handling unexpected hash input.
If bugs found by fuzzing are being closed as permanent WontFix - with no intention to ever return to them - I think that that may be unwise.
But maybe that's not what these closings mean. For example, maybe closing them means that they're effectively being moved to the bottom of the priority list. And if that's what closing it means, culturally, for JtR, that's of course understandable (and I'll remember that for future work :) )
[Note that I posted this before I saw @solardiz 's response]
@ghost commented on GitHub (Dec 15, 2018):
Royce and Solar, I'm afraid you both are not looking at the real problem.
Nobody cares to fix some formats. There are a lot of abandoned formats, and that is the real bug needing a solution.
--format=desired-format.Keep it open to pretend we are going to fix?
@roycewilliams commented on GitHub (Dec 15, 2018):
I was indeed missing that context. I don't really mean to be defending this specific issue, since I don't really understand it. I was responding more to just the sentiment used at the point of closing this and one other issue, that seemed to be deprecating the value of fixing fuzzing-found bugs generally.
@solardiz commented on GitHub (Dec 15, 2018):
I'm not saying we should re-open this issue. I'm saying we should document that we're not consistently finding and fixing (nor avoiding, which would have been even better) issues like this, so that there isn't a wrong expectation by the users. I am serious about adding this
INSECURITYfile. This was on my mental to-do for jumbo for years.As to marking specific formats as known-problematic (and excluding them from auto-detection by default?), we can do that as well. But adding an
INSECURITYfile is probably more important as it "addresses" the general state of jumbo wrt untrusted input, which won't change if we merely fix a couple of known bugs or exclude a couple of known-problematic formats.That said, the state of jumbo wrt untrusted input has probably improved from awful to poor since and in part due to the introduction of better built-in tests and fuzzer in 2015.
@magnumripper commented on GitHub (Dec 16, 2018):
I'm fine with anything suggested here as long as you don't expect me to do it.
My main problem with this issue (and many similar, not sure how many are still open) is not that someone used a fuzzer per se - the problem is that the real hashes in most of the "fuzz bug" formats come from a something2john tool that is likely to get things right in terms of lengths, fields, formats and so on. Then Frank et al posts a gazillion bugs about what happens if you f@ck with those input strings. That just doesn't make sense as long as we're short on people. You could just as well fuzz the memory bus during a session and then post issues about John acting up. Right now there's only two persons likely to look at an issue like this one: @kholia and me. We have 27 open issues that are very much more likely to be real world bugs. Many of them are everything but trivial.
Besides, this is old. I wouldn't be surprised if it's fixed long ago (without anyone realizing it affected this issue). So before even documenting this, someone will have to reproduce the problem in the first place or we're producing worthless documentation, right?
So technically we could invent a new label "Re-verify" and hope that Frank does that - but I'm pretty sure he won't have time so it will be a W.O. anyway.
@solardiz commented on GitHub (Dec 16, 2018):
Not to argue, but I feel I need to explicitly mention that even if a bug is not triggerable when going through the normal "something2john" tool, it is nevertheless triggerable by malicious files that the user doesn't even intend to be of the "something" format (and hence would reasonably not run the extra tool on them first). So there's security impact here if jumbo's security when faced with untrusted input is reasonably expected, and "something2john" never producing such output doesn't fully eliminate that aspect.
@frank-dittrich commented on GitHub (Dec 17, 2018):
I've been fuzzing agilekeychain format now for more than 13 hours using afl (http://lcamtuf.coredump.cx/afl/).
So far, no crash found.
Then I checked the details of the call stack for this issue and for https://github.com/magnumripper/JohnTheRipper/issues/2003.
In both cases, the error occurs in line 105 of dyna_salt.c, i.e., the first
dump_stuff_msg. (That code hasn't changed since 2016):So it looks like normal users shouldn't be affected, not even with malicious input files.
I'll see if I manage to trigger a crash with DYNA_SALT_DEBUG-
[GH-ISSUE #2005] ASan: heap-buffer-overflow for agilekeychain format when fuzzingto [GH-ISSUE #2005] ASan: heap-buffer-overflow for agilekeychain format when fuzzing