Conversation
|
Awesome! I currently don't have a multi forest lab at hand - do you know how this behaves with regards to DNS? Currently we have a DNS resolver, and I’m not sure how Impacket's auto-feature works - whether it's IP-based or DNS based when it gets referred and such |
You can just use a parent-child environment, that will give you the same error
# krb5/kerberosv5.py l.476
res = decoder.decode(r, asn1Spec = TGS_REP())[0]
spn = Principal()
spn.from_asn1(res['ticket'], 'realm', 'sname')
if spn.components[0] == serverName.components[0]:
# Yes.. bye bye
return r, cipher, sessionKey, newSessionKey
else:
# Let's extract the Ticket, change the domain and keep asking
domain = spn.components[1]
return getKerberosTGS(serverName, domain, kdcHost, r, cipher, newSessionKey)For DNS resulution, it doesn't seem to have any internal resolver, just using # krb5/kerberosv5.py l.53
def sendReceive(data, host, kdcHost, port=88):
# [...]
# targetHost is either domain or user supplied -dc-ip <ip>
af, socktype, proto, canonname, sa = socket.getaddrinfo(targetHost, port, 0, socket.SOCK_STREAM)[0]This recursion could be implemented on Certipy to preserve the use of the internal DNS resolver (and is the only way I guess ?). But that would mean rewriting |
|
Any news on this one ? |
I recently had trouble authenticating using cross-realm kerberos tickets. Certipy didn't manage to retreive a valid ST for a service on a different domain and was also unable to authenticate when supplied with a valid cross-realm ST (manually through KRB5CCNAME).
I think this issue is also mentioned here #328
This fixes both cases (and from my testing won't break any other, but this should be properly tested) :
getKerberosTGS, certipy populates thekdc_hostvalue with the -dc-ip user supplied parameter or resolves the initial domain name to get akdc_hostvalue (ip address)getKerberosTGSto always query the same kdc, resulting in aKDC_ERR_WRONG_REALMerror(Since this effectively means trying to acquire an ST for SPN/DomainB by asking DomainA KDC)
Noneforkdc_host,getKerberosTGSimpacket function handles the kdc switching mechanism on it's own and the final ST is retrieved (just like getST.py would)domainvariable is extracted from the decoded final ticketrealmattribute of the decoded ST is relative to DomainB and not the initial identity from DomainA userdomainvariable (extracted from cli parameter or parsed on the .ccache) fixes the missmatchI'm aware this requires DNS resolution to work but when doing cross-realm authentication, I think it's a fair requirement to avoid a lot of coding addition.