Fix difference between cname/crealm in TGS-REP cleartext vs ticket enc-part #406
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.
What's the problem?
The cname and crealm fields in a KDC-REP should be the same in the cleartext body as in the enc-part of the ticket. Currently, they are generated by two slightly different implementations, which can lead to mismatches.
This is a problem, because the TGS-REP's cleartext cname/crealm get placed into the AP-REQ's Authenticator structure, see RFC 4120 § 3.2.2. Generation of a KRB_AP_REQ Message:
And the AP then compares the cname/crealm in Authenticator to the encrypted cname/crealm in the ticket, see RFC 4120 § 3.2.3. Receipt of KRB_AP_REQ Message:
What's the solution?
For TGS-REP cleartext, copy cname/crealm from the ticket enc-part instead of regenerating them.
I included a unit test that triggered the bug. Before the fix, it would return
computer$in the cleartext, and `computer$@test.com" in the ticket enc-part. Now it returns the latter in both (principals without realms were handled differently by the code doing the ticket enc-part, compared to the code doing cleartext).What issue is this related to, if any?
None.