[GH-ISSUE #637] Add native support for cracking various ETypes (no libkrb5 stuff) #295

Closed
opened 2026-10-14 03:00:17 +07:00 by bsakaguchi · 28 comments
Owner

Originally created by @kholia on GitHub (Jun 17, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/637

Originally created by @kholia on GitHub (Jun 17, 2014). Original GitHub issue: https://github.com/openwall/john/issues/637 - http://pig.made-it.com/kerberos-etypes.html
bsakaguchi 2026-10-14 03:00:17 +07:00
Author
Owner

@kholia commented on GitHub (Jun 22, 2014):

The krb5-23_fmt.c format is not needed at all. krb5-23 hashes are just NT hashes!

See src/lib/crypto/krb/s2k_rc4.c file in the MIT Kerberos source code, if you are curious.

$ cat krb23-hashes  # taken from krb5-23_fmt.c file
8846f7eaee8fb117ad06bdd830b7586c
32ed87bdb5fdc5e9cba88547376818d4

$ ../run/john --format=nt krb23-hashes
Loaded 2 password hashes with no different salts (NT [MD4 128/128 X2 SSE2-16])
Press 'q' or Ctrl-C to abort, almost any other key for status
123456           (?)
password         (?)
...
$ cat src/lib/crypto/krb/s2k_rc4.c | grep Microsoft
    /* We ignore salt per the Microsoft spec. */

M$ is the best ;)

<!-- gh-comment-id:46784355 --> @kholia commented on GitHub (Jun 22, 2014): The `krb5-23_fmt.c` format is not needed at all. `krb5-23` hashes are just `NT` hashes! See `src/lib/crypto/krb/s2k_rc4.c` file in the MIT Kerberos source code, if you are curious. ``` $ cat krb23-hashes # taken from krb5-23_fmt.c file 8846f7eaee8fb117ad06bdd830b7586c 32ed87bdb5fdc5e9cba88547376818d4 $ ../run/john --format=nt krb23-hashes Loaded 2 password hashes with no different salts (NT [MD4 128/128 X2 SSE2-16]) Press 'q' or Ctrl-C to abort, almost any other key for status 123456 (?) password (?) ... ``` ``` $ cat src/lib/crypto/krb/s2k_rc4.c | grep Microsoft /* We ignore salt per the Microsoft spec. */ ``` M$ is the best ;)
Author
Owner

@kholia commented on GitHub (Jun 22, 2014):

In short, this "discovery" allows us to use our custom awesome NT format for cracking such hashes at very high speeds.

<!-- gh-comment-id:46784546 --> @kholia commented on GitHub (Jun 22, 2014): In short, this "discovery" allows us to use our custom awesome `NT` format for cracking such hashes at very high speeds.
Author
Owner

@jfoug commented on GitHub (Jun 22, 2014):

Are we 100% sure this is the case, for non ASCII characters, and that there are no encoding nuances between the 2 formats?

<!-- gh-comment-id:46784664 --> @jfoug commented on GitHub (Jun 22, 2014): Are we 100% sure this is the case, for non ASCII characters, and that there are no encoding nuances between the 2 formats?
Author
Owner

@kholia commented on GitHub (Jun 22, 2014):

Kerberos calls the krb5int_utf8cs_to_ucs2les function for encoding the original password.

I don't understand this encoding craziness at all, so I would simply say that I am not 100% sure.

<!-- gh-comment-id:46784709 --> @kholia commented on GitHub (Jun 22, 2014): Kerberos calls the `krb5int_utf8cs_to_ucs2les` function for encoding the original password. I don't understand this encoding craziness at all, so I would simply say that I am not 100% sure.
Author
Owner

@jfoug commented on GitHub (Jun 22, 2014):

I tested with this password (same one, with utf8 encoding, and with asii encoding). Both work:

   {"8bd6e4fb88e01009818749c5443ea712", "\xC3\xBC"},
   {"8bd6e4fb88e01009818749c5443ea712", "\xFC"},
<!-- gh-comment-id:46785073 --> @jfoug commented on GitHub (Jun 22, 2014): I tested with this password (same one, with utf8 encoding, and with asii encoding). Both work: ``` {"8bd6e4fb88e01009818749c5443ea712", "\xC3\xBC"}, {"8bd6e4fb88e01009818749c5443ea712", "\xFC"}, ```
Author
Owner

@jfoug commented on GitHub (Jun 22, 2014):

I do believe this is just a 100% straight NT format, ONLY an order of magnitude slower than jtr's NT format.

<!-- gh-comment-id:46785103 --> @jfoug commented on GitHub (Jun 22, 2014): I do believe this is just a 100% straight NT format, ONLY an order of magnitude slower than jtr's NT format.
Author
Owner

@kholia commented on GitHub (Jun 22, 2014):

Awesome 👍

Also, that was my conclusion too regarding the speed difference.

<!-- gh-comment-id:46785341 --> @kholia commented on GitHub (Jun 22, 2014): Awesome :+1: Also, that was my conclusion too regarding the speed difference.
Author
Owner

@magnumripper commented on GitHub (Jun 22, 2014):

LOL!

<!-- gh-comment-id:46791201 --> @magnumripper commented on GitHub (Jun 22, 2014): LOL!
Author
Owner

@frank-dittrich commented on GitHub (Jun 23, 2014):

KRB5-23 has max. password length 32, whereas NT and NT2 have just 27.

<!-- gh-comment-id:46912653 --> @frank-dittrich commented on GitHub (Jun 23, 2014): KRB5-23 has max. password length 32, whereas NT and NT2 have just 27.
Author
Owner

@magnumripper commented on GitHub (Jun 23, 2014):

But that's just silly because such a slow format really should be doing 125.

<!-- gh-comment-id:46915996 --> @magnumripper commented on GitHub (Jun 23, 2014): But that's just silly because such a slow format really should be doing 125.
Author
Owner

@magnumripper commented on GitHub (Jun 23, 2014):

So why is it called RC4-HMAC?

<!-- gh-comment-id:46916032 --> @magnumripper commented on GitHub (Jun 23, 2014): So why is it called RC4-HMAC?
Author
Owner

@kholia commented on GitHub (Jun 24, 2014):

The name RC4-HMAC sounds much more impressive than plain HMAC.

Seriously, who will want the plain HMAC when you can get RC4-HMAC from our friends at M$ for free!

<!-- gh-comment-id:47015721 --> @kholia commented on GitHub (Jun 24, 2014): The name `RC4-HMAC` sounds much more impressive than plain `HMAC`. Seriously, who will want the plain `HMAC` when you can get `RC4-HMAC` from our friends at M$ for free!
Author
Owner

@magnumripper commented on GitHub (Jun 24, 2014):

Lol but it's neither RC4 nor HMAC, just unsalted, uniterated MD4.

<!-- gh-comment-id:47016383 --> @magnumripper commented on GitHub (Jun 24, 2014): Lol but it's neither RC4 nor HMAC, just unsalted, uniterated MD4.
Author
Owner

@kholia commented on GitHub (Jun 24, 2014):

I can tell that you are new to marketing ;)

On a serious note, I will try to get some more code reading done (in the coming days) to figure this out.

<!-- gh-comment-id:47016720 --> @kholia commented on GitHub (Jun 24, 2014): I can tell that you are new to marketing ;) On a serious note, I will try to get some more code reading done (in the coming days) to figure this out.
Author
Owner

@kholia commented on GitHub (Nov 18, 2014):

There doesn't seem to be any interest in this task (doesn't look important enough), hence closing.

<!-- gh-comment-id:63466695 --> @kholia commented on GitHub (Nov 18, 2014): There doesn't seem to be any interest in this task (doesn't look important enough), hence closing.
Author
Owner

@jfoug commented on GitHub (Dec 10, 2014):

I may have a crack at krb5-18

That format SUX when it comes to openmp. We really should do it native, and get a 5 to 40x improvement.

<!-- gh-comment-id:66539845 --> @jfoug commented on GitHub (Dec 10, 2014): I may have a crack at krb5-18 That format SUX when it comes to openmp. We really should do it native, and get a 5 to 40x improvement.
Author
Owner

@kholia commented on GitHub (Dec 11, 2014):

IIRC, this format also causes lot of problems on OS X and FreeeBSD, right?

Rewriting it seems like a great idea 👍

<!-- gh-comment-id:66579741 --> @kholia commented on GitHub (Dec 11, 2014): IIRC, this format also causes lot of problems on OS X and FreeeBSD, right? Rewriting it seems like a great idea :+1:
Author
Owner

@magnumripper commented on GitHub (Dec 11, 2014):

It's fine on OSX except it's slow (305 c/s, no OMP - should be ~2400 c/s per core). But we can drop a dependency and a boatload of autoconf lines once we ditch libkrb5 👍

<!-- gh-comment-id:66598335 --> @magnumripper commented on GitHub (Dec 11, 2014): It's fine on OSX except it's slow (305 c/s, no OMP - should be ~2400 c/s per core). But we can drop a dependency and a boatload of autoconf lines once we ditch libkrb5 :+1:
Author
Owner

@kholia commented on GitHub (Dec 11, 2014):

Once we do this, I promise not to introduce crap dependencies like this 👍

<!-- gh-comment-id:66601583 --> @kholia commented on GitHub (Dec 11, 2014): Once we do this, I promise not to introduce crap dependencies like this :+1:
Author
Owner

@jfoug commented on GitHub (Dec 11, 2014):

are there other formats the depend on libkrb5? Following the krb source code is not overly easy, trying to rev engineer this stuff. The reason it is so slow, is the over dependence on 10 layers of generic behavior. Yes, it may make writing one liners like krb5_c_get_key(x,y,z) but the speed is horrible.

It looks like krb5-18 is little more than pbkdf2-sha1(4096) with some key building stuff after. I am still not 100% sure, I am going to build the source, add some dmp_suff() calls at certain points, and see if I can match the format in pass_gen.pl (as a starting point). Once I get to that level, it should not be too hard to make it a native format.

<!-- gh-comment-id:66611548 --> @jfoug commented on GitHub (Dec 11, 2014): are there other formats the depend on libkrb5? Following the krb source code is not overly easy, trying to rev engineer this stuff. The reason it is so slow, is the over dependence on 10 layers of generic behavior. Yes, it may make writing one liners like krb5_c_get_key(x,y,z) but the speed is horrible. It looks like krb5-18 is little more than pbkdf2-sha1(4096) with some key building stuff after. I am still not 100% sure, I am going to build the source, add some dmp_suff() calls at certain points, and see if I can match the format in pass_gen.pl (as a starting point). Once I get to that level, it should not be too hard to make it a native format.
Author
Owner

@magnumripper commented on GitHub (Dec 11, 2014):

Once we do this, I promise not to introduce crap dependencies like this

PoC formats with or without dependencies are always way better than nothing, and many really good formats has evolved from them - many that otherwise would probably not exist at all. Keep up the good work!

<!-- gh-comment-id:66693722 --> @magnumripper commented on GitHub (Dec 11, 2014): > Once we do this, I promise not to introduce crap dependencies like this PoC formats with or without dependencies are always way better than nothing, and many really good formats has evolved from them - many that otherwise would probably not exist at all. Keep up the good work!
Author
Owner

@magnumripper commented on GitHub (Dec 11, 2014):

are there other formats the depend on libkrb5?

We already ditched krb5-23, so no.

<!-- gh-comment-id:66694093 --> @magnumripper commented on GitHub (Dec 11, 2014): > are there other formats the depend on libkrb5? We already ditched krb5-23, so no.
Author
Owner

@magnumripper commented on GitHub (Dec 16, 2014):

It would be terrific to be able to drop the libkrb dependency before J1...

<!-- gh-comment-id:67112616 --> @magnumripper commented on GitHub (Dec 16, 2014): It would be terrific to be able to drop the libkrb dependency before J1...
Author
Owner

@jfoug commented on GitHub (Dec 16, 2014):

The algo for krb5-18 is now in pass_gen.pl, so it should be easy to get it into the JtR format.

Very simple algorithm (hidden in 1000's of lines of garbage in the krb5 lib code). It is just a call to pbkdf2-hmac-sha1(4096) for 2 limbs, then use that as the key for AES, encrypt a constant, and re-encrypt the results for the last 16 bytes for the total 32 byte 'key'

I will get a full test-suite file made, and make SURE that the existing format linked against the -lkrb5 cracks all 1500. Then once we port out of -lkrb5 it still should be fully cracked.

When done, do we simply want to SCRUB the krb5 support from configure.ac ? We could always put it 'back' in later, using git to pull history to see how it was done.

<!-- gh-comment-id:67254867 --> @jfoug commented on GitHub (Dec 16, 2014): The algo for krb5-18 is now in pass_gen.pl, so it should be easy to get it into the JtR format. Very simple algorithm (hidden in 1000's of lines of garbage in the krb5 lib code). It is just a call to pbkdf2-hmac-sha1(4096) for 2 limbs, then use that as the key for AES, encrypt a constant, and re-encrypt the results for the last 16 bytes for the total 32 byte 'key' I will get a full test-suite file made, and make SURE that the existing format linked against the -lkrb5 cracks all 1500. Then once we port out of -lkrb5 it still should be fully cracked. When done, do we simply want to SCRUB the krb5 support from configure.ac ? We could always put it 'back' in later, using git to pull history to see how it was done.
Author
Owner

@magnumripper commented on GitHub (Dec 17, 2014):

When done, do we simply want to SCRUB the krb5 support from configure.ac ? We could always put it 'back' in later, using git to pull history to see how it was done.

Yes I think so. Make a commit that does that and nothing else (ie. separate from changes to the format).

<!-- gh-comment-id:67257109 --> @magnumripper commented on GitHub (Dec 17, 2014): > When done, do we simply want to SCRUB the krb5 support from configure.ac ? We could always put it 'back' in later, using git to pull history to see how it was done. Yes I think so. Make a commit that does that and nothing else (ie. separate from changes to the format).
Author
Owner

@jfoug commented on GitHub (Dec 17, 2014):

1098b10 (for the format). i got 16x improvement on my laptop (well, about 950x on OMP cygwin, lol, since the -lkrb5 OMP was busted on cygwin).

I will clean up -lkrb5 / HAVE_KRB5 stuff from rest of project on another commit. 73d8e17

<!-- gh-comment-id:67278170 --> @jfoug commented on GitHub (Dec 17, 2014): 1098b10 (for the format). i got 16x improvement on my laptop (well, about 950x on OMP cygwin, lol, since the -lkrb5 OMP was busted on cygwin). I will clean up -lkrb5 / HAVE_KRB5 stuff from rest of project on another commit. 73d8e17
Author
Owner

@kholia commented on GitHub (Dec 17, 2014):

AWESOME 👍

<!-- gh-comment-id:67282376 --> @kholia commented on GitHub (Dec 17, 2014): AWESOME :+1:
Author
Owner

@magnumripper commented on GitHub (Dec 17, 2014):

+1 👍

<!-- gh-comment-id:67300984 --> @magnumripper commented on GitHub (Dec 17, 2014): +1 :+1:
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#295
No description provided.