Kerberos AS-REP Cracking
Just looking to understand how the cracking of kerberos AS-REP encrypted data works if anyone can explain?

I'm talking about mode -m 18200 and as an example the input for a password of "password123" looks like this:


If I've understood the Kerberos RFC correctly ( then the actual data contained in this cipher is:

EncKDCRepPart  ::= SEQUENCE {
          key            [0] EncryptionKey,
          last-req        [1] LastReq,
          nonce          [2] UInt32,
          key-expiration  [3] KerberosTime OPTIONAL,
          flags          [4] TicketFlags,
          authtime        [5] KerberosTime,
          starttime      [6] KerberosTime OPTIONAL,
          endtime        [7] KerberosTime,
          renew-till      [8] KerberosTime OPTIONAL,
          srealm          [9] Realm,
          sname          [10] PrincipalName,
          caddr          [11] HostAddresses OPTIONAL

So I'm just curious how exactly does hashcat know when it has got the correct password? 

I believe the sname property mentioned above will contain the same principal name that is being passed in to hashcat right before the hash (jsmith@SCRM.LOCAL in my example). So is hashcat comparing that passed in value to the decrypted sname value with each cracking attempt? 

I had a quick look at the hashcat source code here:

But although I can usually follow C/C++ ok for the most part, here I can't see where its actually doing anything like what I mentioned above. In fact all it seems to do is just parse the input and set some properties. Doesn't seem like it actually checks anything or decrypts anything at all, so I must be missing something. Is there somewhere else in the source code that handles that, and if so how do I find it? 

Sorry for probably very noob question and thanks in advance
the code you're actually looking for is here:
The algorithm is of course implemented in OpenCL code:

You could also look at the perl test module:
Thanks for the quick replies guys, much appreciated.

I've had a good look at that OpenCL code you linked to but still struggling to wrap my head around it. Especially as I can't seem to see where where some of the parameter values are coming from. Probably just my C noobness, sorry. If anyone does understand how this format in particular is handled and fancies explaining it to me then that would be great, but no worries if not.

Looking at the perl module, I can't tell if this is just for generating a test hash for the main program to try and crack or if this is actually the routine that tests if passwords are correct? I mean I see this part:

my $check_correct  = ((substr ($ticket_decrypt, 16, 4) eq "7981" && substr ($ticket_decrypt, 22, 2) eq "30")) ||
                         ((substr ($ticket_decrypt, 16, 2) eq "79") && (substr ($ticket_decrypt, 20, 2) eq "30")) ||
                         ((substr ($ticket_decrypt, 16, 4) eq "7982")  && (substr ($ticket_decrypt, 24, 2) eq "30"));

which is obviously checking for specific values at specific points in the decrypted output. But is this just for the test module using a specific password or something so it knows these characters should always be in the result. Or is this exactly the same as what the program does to decide if the hash has been cracked?
the decrypted bytes do have a specific structure:
(02-21-2020, 08:17 PM)philsmd Wrote: the decrypted bytes do have a specific structure:

Ah ok thanks. I did see that comment and thought that might be the case originally, especially as some of the values its looking for matched with the perl script. But then the fact that the code in that function carries on for so long afterwards made me think it can't be the final part where it checks to see if the hash has been decrypted correctly.

So what are the extra 100 lines of code after that doing?
Oh wait I think I was misunderstanding and thinking that returning 0 indicated success. But now I'm thinking maybe returning 1 is success and 0 means failure. So in that case that check you highlighted is just so early in the function because if those bytes are not set correctly at that point, there's no point going any further and checking the checksum etc. Is that about right?
yes, early reject optimizations