mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1990] SIP format in legacy clang build FAILED: (Could not find salt in db - salt() return inconsistent?) #1333
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#1333
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 12, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/1990
Originally assigned to: @frank-dittrich on GitHub.
Not that legacy clang builds are top priority, but nevertheless:
SIP format is the only one which fails in a legacy clang build using
Any idea what could be wrong here?
With a gcc legacy build, SIP format doesn't fail self test.
Is clang to blame? Should I test with a more recent clang version (3.7 instead of 3.5)?
But on the same system, with an autoconf clang build, SIP format passes self test.
@magnumripper commented on GitHub (Jan 12, 2016):
Probably a bug in get_salt()... but I can't spot it.
@frank-dittrich commented on GitHub (Jan 16, 2016):
I commented out all except the first self test, confirmed that the error still exists,
added a dump_stuff_msg() at the end of get_salt() and inside fmt_self_test_body().
Turns out that the value returned by get_salt() is exactly the same as the value of salt in dump_stuff_msg().
But for the only db entry, dbsalt->salt has some extra bytes filled that are 0x00 in salt.
So for me it doesn't look as if SIP format's get_salt() is to blame.
Instead, somehow a mangled salt has been stored in the db.
@magnumripper commented on GitHub (Jan 29, 2016):
I still think it's a bug in the format.
This makes no sense. What do you mean "extra"? Are those bytes within format->params.salt_size or not?
@frank-dittrich commented on GitHub (Jan 29, 2016):
Yes, those bytes are within the format's salt size.
But within the salt size, the hash has lots of 0x00 bytes.
@frank-dittrich commented on GitHub (Jan 29, 2016):
The first line is the salt at the end of get_salt, the second one is the "same" salt stored in the db:
@frank-dittrich commented on GitHub (Jan 29, 2016):
BTW: for some reason, the clang legacy linux-x86-64 build is just using SSE2, not SSE4.1, not AVX:
@magnumripper commented on GitHub (Jan 29, 2016):
So they differ a whole lot. Well the db isn't going to change itself. It copies params.salt_size bytes starting at the address returned by get_salt(). Just put more dump_stuff calls all over the place.
@frank-dittrich commented on GitHub (Feb 15, 2016):
BTW: Here (1st line) is what that same hash looks like for an autoconf clang build:
Lines 2 and 3 are from the legacy clang build output.
The first bytes that are initial in the clang autoconf build, but filled in the clang legacy build, are
313932 2e313638 2e312e31Translated to ascii, that's
192.168.1.104, which is the IP address stored in the first self test:Why is it that clang legacy still has that information, but clang autoconf doesn't?.
OTOH, the clang autoconf build has some bytes filled which are initial in the clang legacy build:
These are:
a343663 63653835 373a3061 38346637 38666465 36366262 31353139.The
63 63653835 37part corresponds tocce857which is part of the first self test sample hash.Furthermore, the clang autoconf build has
37656162 39363134 36326463 3266where the clang legacy build's get_salt() has 0x00 bytes.Quite confusing.
Any idea where adding more dump_stuff_msg() could be added?
@frank-dittrich commented on GitHub (Feb 15, 2016):
I just noticed that in a legacy clang build SIP has salt size 472, while for other builds (legacy linux-x86-64 (gcc), autoconf gcc and clang) the salt size is 412.
Also, a legacy gcc build has exactly the same salt as the autoconf clang build.
@frank-dittrich commented on GitHub (Feb 15, 2016):
BTW: Now that we have clang on well, this error can be reproduced on well:
@jfoug commented on GitHub (Feb 15, 2016):
SIP has a MD5_CTX in the salt, that is pre-loaded up to a point. That easily explains the size difference (if not using oSSL, or something).
I also wonder if there is something allocated in a MD5_CTX happening on the legacy clang build? If so, then the salts are not going to match.
Adding a CTX to a salt structure is done to allow some of the work to be done 1 time, and then used later in crypt_all. I wonder if that is not always a valid thing to do?
@magnumripper commented on GitHub (Feb 15, 2016):
The salt struct layout/size is not not an issue, a struct is essentially a black box because the compiler is free to pad and/or reorder stuff within it. What matters is the input format.
@magnumripper commented on GitHub (Feb 15, 2016):
That error is obviously an issue of course
@buzzdeee commented on GitHub (Nov 24, 2020):
I've the same problem, with legacy buidl on OpenBSD:
john --list=build-info
Version: 1.9.0-jumbo-1
Build: openbsd-x86-64
SIMD: SSE2, interleaving: MD4:4 MD5:5 SHA1:2 SHA256:1 SHA512:1
System-wide exec: /usr/libexec/john
System-wide home: /etc/john
Private home: ~/.john
$JOHN is /etc/john/
Format interface version: 14
Max. number of reported tunable costs: 4
Rec file version: REC4
Charset file version: CHR3
CHARSET_MIN: 1 (0x01)
CHARSET_MAX: 255 (0xff)
CHARSET_LENGTH: 24
SALT_HASH_SIZE: 1048576
SINGLE_IDX_MAX: 32768
SINGLE_BUF_MAX: 65535
Effective limit: Max. KPC 4096 at length 16, down to 525 at length 125
Max. Markov mode level: 400
Max. Markov mode password length: 30
clang version: 10.0.1 (gcc 4.2.1 compatibility)
File locking: fcntl()
fseek(): fseek
ftell(): ftell
fopen(): fopen
memmem(): JtR internal
@solardiz commented on GitHub (Nov 24, 2020):
We should probably look into and fix the SIP format's issue.
@buzzdeee That said, why are you using a legacy build on OpenBSD? I'd expect
./configure && maketo work on OpenBSD, doesn't it?@solardiz commented on GitHub (Nov 24, 2020):
Reproduced in a
make -f Makefile.legacy linux-x86-64-clangbuild:This fixes it:
@solardiz commented on GitHub (Nov 24, 2020):
I identified 3 other formats that copy MD5 contexts: EIGRP, HSRP, and tacacs-plus. However, per code review these do not have the same issue. 2 of them do keep the MD5 context inside their salt structures, but they zeroize the structure and then
MD5_Initthe context right inside the structure, not via amemcpy.@buzzdeee commented on GitHub (Nov 24, 2020):
The current ports tree is at john-jumbo 1.8.0-1, and that uses the legacy build to create the package:
https://cvsweb.openbsd.org/ports/security/john-jumbo/
The Makefile is a bit messy. With the 1.8.0-1 all tests pass.
After reading the issue here, I actually tried configure && gmake however, that's why I then commented here.
Now tried to reproduce, and linking just works. maybe I had some other stuff around from prior build.
However, with ./configure && gmake compilation breaks:
however, then gmail fails:
Then, running the tests, two tests fail:
Testing: skey, S/Key [MD4/MD5/SHA1/RMD160 32/64]... FAILED (cmp_all(1))
Testing: crypt, generic crypt(3) [?/64]... Warning: hash encoding string length 13, type id #1
appears to be unsupported on this system; will not load such hashes.
FAILED (valid (before init))
@solardiz commented on GitHub (Nov 24, 2020):
@buzzdeee Thanks. Is this with our latest code from this repo?
We don't recommend overriding
CFLAGSas that drops our optimization options. You should probably useCPPFLAGSinstead.The
eapmd5tojohn.cbuild errors suggest incompatibility of our code in there with the version of libpcap you have on the system. We should probably introduce some#ifdeflogic in there to exclude the functionality unsupported by build system's libpcap (we'd welcome a pull request doing that), but meanwhile you should be able to build with--disable-pcap(thus, excluding entire tools).We'll need to look into the skey format failure if it's indeed seen with our latest code - please confirm.
The crypt format failure is "correct" - as I understand, OpenBSD dropped support for those hashes. I don't know whether we should do anything about that in JtR. Maybe exclude those test vectors from that format when built for OpenBSD (again, a pull request is welcome).
@solardiz commented on GitHub (Nov 24, 2020):
I just took care of this myself, it's #4488 now.
@buzzdeee commented on GitHub (Nov 24, 2020):
the meset patch makes all tests pass in legacy build mode:
All 705 formats passed self-tests!
@solardiz commented on GitHub (Nov 24, 2020):
@buzzdeee What "meset patch"? Also, perhaps your build somehow fails to read its
john.conf. There should be a little over 400 formats tested with our default settings.@buzzdeee commented on GitHub (Nov 24, 2020):
sorry, typo, just wanted to confirm, the added memset in the sip_fmt_plug.c works for me.
I'm currently with the latest release 1.9.0-jumbo-1
I'll see to find a clean system for testing, then I'll look at current code regarding the skey test, and the number of tests.
@solardiz commented on GitHub (Nov 24, 2020):
@buzzdeee I'd appreciate it if you also review the patches in the OpenBSD port for relevance to our current code, and send us PR(s) accordingly. At a glance, perhaps at least the patches having to do with
getopt()return value type are still relevant. Thanks!