Open thatux opened 1 year ago
My goal original goal was to be able to debug openssl, but that also works without the debug
This works for me to do that:
cd /tmp
git clone https://github.com/openssl/openssl
git clone https://github.com/openwall/john/
cd openssl
./Configure
make -sj20
cd ../john/src
./configure OPENSSL_LIBS="-L/tmp/openssl -lssl -lcrypto"
make -sj20
The original bug still exists
Thanks for your bug report.
This looks like an obscure bug in the gpg format as stated in cracker.c:
* We should have already called fmt_self_test() from john.c. This redundant
* self-test is only to catch some more obscure bugs in debugging builds (it
* is a no-op in normal builds).
We need the magnum's help to understand what's going on.
I can reproduce. Perhaps that extra self-test indeed found an obscure bug, but I have yet to understand what is happening. Using --skip-self-tests
works around it and the hash is cracked. I can't find any other #if DEBUG
that could interfere.
I was also able to reproduce. And failed to understand how could it be db != db.
OK, the problem is (I'm pretty sure) that at this point, db
is the real database, not the test db made from test vectors. So that's just a minor bug that existed ever since the test db thing was introduced, and no-one stumbled upon it until the OP did now.
Except...
When I do a similar test with for example the NT format, there's no problem. How can that NOT be a problem?
Here's a fix:
diff --git a/src/cracker.c b/src/cracker.c
index 681be8a98..779763c51 100644
--- a/src/cracker.c
+++ b/src/cracker.c
@@ -176,11 +176,15 @@ void crk_init(struct db_main *db, void (*fix_state)(void),
* or if the format has a custom reset() method (we've already called reset(db)
* from john.c, and we don't want to mess with the format's state).
*/
- if (db->loaded && db->format->methods.reset == fmt_default_reset)
- if ((where = fmt_self_test(db->format, db))) {
- log_event("! Self test failed (%s)", where);
- fprintf(stderr, "Self test failed (%s)\n", where);
- error();
+ if (db->loaded && db->format->methods.reset == fmt_default_reset && !(options.flags & FLG_NOTESTS)) {
+ struct db_main *test_db = ldr_init_test_db(db->format, db);
+
+ if ((where = fmt_self_test(db->format, test_db))) {
+ log_event("! Self test failed (%s)", where);
+ fprintf(stderr, "Self test failed (%s)\n", where);
+ error();
+ }
+ ldr_free_db(test_db, 1);
}
#if HAVE_OPENCL
...but I don't want to commit it until I understand why NT doesn't have any problems with the current code.
If NT
loads the actual database and the test doesn't fail, then ssh
is changing something in a way that might actually be a bug.
On the other hand, who knows, something needs to be changed during load.
The real issue is: what does this test do and how does it catch bugs.
I have 14 CPU formats turned off before the test.
If
NT
loads the actual database and the test doesn't fail, thenssh
is changing something in a way that might actually be a bug.
(You meant gpg, but) they should fail, I can't see why NT (and probably some others, haven't had time to test yet) does not.
Here's a fix: [...] ...but I don't want to commit it until I understand why NT doesn't have any problems with the current code.
Do we really want to keep this issue completely unfixed for 1+ year just because we didn't fully understand why it didn't show up in some cases? That could make sense if @magnumripper or someone else were available to investigate it fully, but that doesn't appear to be the case now. So maybe just try applying the patch we have here?
Before merging, we should check again (if and how it fails now). gpg
is a format that was recently fixed.
I'd revisit it, but my backlog is kinda huge. I guess we should implement that fix.
It's really great to see you back, @magnumripper!
I guess we should implement that fix.
Since the fix is yours, would you be the one to commit it, please?
I think the recent changes in our gpg*
formats are unrelated to this issue; I really don't expect them to have made any difference here.
i'm on the latest commit 933bbdb95, using wsl
using one of the fmt_tests hashes and building with
debug
causes a selftest failbuilding without the
debug
flag works without a problem and cracks the hashAttach details about your OS and about john, including:
./john --list=build-info
. build-info.log