Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kerberoast: Subscript out of range #1

Open
kram12085 opened this issue Mar 23, 2022 · 6 comments
Open

Kerberoast: Subscript out of range #1

kram12085 opened this issue Mar 23, 2022 · 6 comments

Comments

@kram12085
Copy link

One of the more fascinating blogs I've come across! Trying the kerberoast.vba POC on my test machine, I'm getting a "Subscript out of range" error at the line that reads the EncodedTicketSize at offset 136. It still generates a .kirbi file but it's full of garbage. Any clue why?
debug

@X-C3LL
Copy link
Contributor

X-C3LL commented Mar 23, 2022

Is it office 64 bits or 32 bits?

Also: can print the value of ResponseSize (use MsgBox) and query the same TGS with mimikatz/rubeus/impacket ?

@kram12085
Copy link
Author

Is it office 64 bits or 32 bits?

Also: can print the value of ResponseSize (use MsgBox) and query the same TGS with mimikatz/rubeus/impacket ?

64 bit. The script won't work with 32 due to the longlong data type.

The SPNs that didn't error had ResponseSizes of around 3055. It was one with a ResponseSize of 0 that triggered the error, I'm assuming is maybe a misconfigured or unreachable SPN. The kirbi files however, don't seem to be the expected hash, attached is one example that didn't cause the error (renamed .log to allow for attaching).
TERMSRV.test.home.com.log

@X-C3LL
Copy link
Contributor

X-C3LL commented Mar 24, 2022

Yep, I can not parse it. Can you paste the whole KERB_RETRIEVE_TKT_RESPONSE?

    'Copy KERB_RETRIEVE_TKT_RESPONSE structure to an array
    Dim Response() As Byte
    Dim Data As String
    ReDim Response(0 To ResponseSize)
    Call CopyMemory(VarPtr(Response(0)), KerbRetrieveResponse, ResponseSize)
 <--- Copy Response to a file

@kram12085
Copy link
Author

Yep, I can not parse it. Can you paste the whole KERB_RETRIEVE_TKT_RESPONSE?

??T
That's it for Response. I'm only a novice at NetSec but am thoroughly confused as to what's happening. Have no issues using Rubeus to obtain the hash.

I'm wondering if it could be some old misconfigured SPNs since I've messed with the test system a lot through the years. Is there a way to target a specific SPN instead of roasting every one in the domain?

@X-C3LL
Copy link
Contributor

X-C3LL commented Mar 25, 2022

Copy the content to a file (you can reuse the loop code) so I can see exactly what is the content and why is failing. In the .kirbi I can see parts that are ok, but others deviates from what I was expecting.

To query a TGS for a specific user you can edit the LDAP query:

    objCommand.CommandText = _
        "<LDAP://" & strDomain & ">;(&(samAccountType=805306368)(samAccountName=YOURUSER));,servicePrincipalName;subtree"

@kram12085
Copy link
Author

Here's Reponse pointed to write to the file in lieu of encodedTicket. Thanks again for helping us learn!
TERMSRV.test.home.com_response.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants