Repository navigation
fix(kerberos): support inter-realm (referral) TGT from a ccache - #2351
Merged
anadrianmanrique merged 3 commits intoNov 3, 2026
Merged
Conversation
Contributor
Author
|
Hey @anadrianmanrique , sorry to bother you again ahaha. If you have a bit of time, could you take a look at this? I think it’s an important fix for Impacket, I’ve had feedback from several engagements where people were unable to use a TGT from domain A to access domain B |
Contributor
|
Hey! I can confirm, this happened to me twice and the only solution we have so far is using this tool https://github.com/AlexLinov/Cross-Realm-TGS/. |
anadrianmanrique
force-pushed
the
fix/cross-realm-referral-tgt
branch
2 times, most recently
from
November 2, 2026 20:44
77e305c to
a4ca783
Compare
anadrianmanrique
force-pushed
the
fix/cross-realm-referral-tgt
branch
from
November 2, 2026 20:46
a4ca783 to
8e97020
Compare
Collaborator
|
I'll merge this one, although I've found issues regarding cached bundled tickets, and also using referrals with intermediate domains, all reproducible in GOAD env. These will be addressed in a separate PR. Thank you! |
godylockz
pushed a commit
to godylockz/impacket
that referenced
this pull request
Nov 11, 2026
…ra#2351) Upstream: fortra#2351 Conflict with fortra#2244 on parseFile: kept anySPN for TGS/TGT lookup, then fall back to getInterRealmTGT.
godylockz
pushed a commit
to godylockz/impacket
that referenced
this pull request
Nov 11, 2026
…2303) Upstream: fortra#2303 Conflict in tests/misc/test_kerberosv5.py with fortra#2351: kept both test classes.
godylockz
pushed a commit
to godylockz/impacket
that referenced
this pull request
Nov 22, 2026
Upstream: fortra#2244 Keep getInterRealmTGT fallback from fortra#2351; pass anySPN through to getCredential.
godylockz
pushed a commit
to godylockz/impacket
that referenced
this pull request
Nov 22, 2026
…2303) Upstream: fortra#2303 Keep fortra#2351 Type3/inter-realm tests alongside sendReceive tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes impacket usable with an inter-realm (referral) TGT (
krbtgt/FOREIGN.REALM@LOCAL.REALM) stored in a ccache, e.g. the onegetST.py -spn krbtgt/FOREIGN.REALMwrites. Two bugs were in the way:CCache.parseFile()only looked forkrbtgt/<domain>@<domain>, so the referral TGT was ignored and impacket fell back to a password-less AS-REQ →KDC_ERR_PREAUTH_FAILED(see "Before"). NewCCache.getInterRealmTGT()returns it.getKerberosTGS()sent the TGS-REQ to the realm that issued the TGT instead of the realm itskrbtgt/<realm>sname grants →KDC_ERR_WRONG_REALM. The realm is now read from the TGT, and only when its sname iskrbtgt/<realm>, so a regular TGT and an explicitly passed realm are unaffected.Fixing it in
getKerberosTGS()covers SMB, LDAP, MSSQL/TDS and DCE/RPC at once.Related: #541, same root cause, opened in 2018, never merged.
Before :
After :