- 
                Notifications
    You must be signed in to change notification settings 
- Fork 100
Improvements for AP-REP validation #400
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
Improvements for AP-REP validation #400
Conversation
| Sorry for not getting to this sooner. The build is back in place and things are moving again. I'm happy with this change. Is it ready to be completed? | 
| Thanks for responding @SteveSyfuhs I am ready to merge the code, but the  Currently, the test is really only testing that sequence number validation is included in  The sequence number validation in the current unit test code is just comparing the sequence number values as generated by the local static method  In practice, we have observed that the sequence numbers in the WinRM use case do not match. RFC 1934 1.1.1 says that the sequence numbers should be included in the AP-REQ Authenticator: 
 and that they will be returned and can be validated, but only in the context of previously received data (RFC 1934 1.2.1.2): 
 The sender should increment its sequence number by one after sending (RFC 1934 1.2.1.2), but the spec doesn't say the sender and receiver should match. We have used this code against a current WinRM implementation, and it only works if we remove the current sequence number validation requirement. For these reasons, I suggest we just delete the current sequence number validation code along with the unit test that requires it. I'll add a commit to make that change, and you can merge if you agree. Or, we can do something different if you prefer. | 
| Yep, agree. Sequence number is slightly more annoying in practice than as implemented here. | 
| Actually small change I made after this got merged. Sequence number does need some level of validation, but it's only checked when explicitly requested instead, plus with specific rules now. | 
Summary of changes:
What's the problem?
We are unable to implement a simple WinRM (HTTP/SOAP) connection setup using GSS-API Krb5 while simulating the WinRM protocol with Kerberos authentication. When selecting the Kerberos authentication option for
Enter-PSSession, PowerShell uses Kerberos directly, not SPNEGO.This change is to have Kerberos.NET make all keys available via the
ApplicationSessionContextto validate GSS-API tokens. The observed behavior that we are following is that the AP-REP is validated with the service ticket session key, and then GSS Wrap/Unwrap uses the subkey returned from the server.What's the solution?
ApplicationSessionContext needs to keep track of sub session keys as well and try multiple options before giving up, in order to accommodate applications that may misbehave relative to common expectations and specifications.
ApplicationSessionContext should not try to validate that the sequence numbers match.
The code in #398 can be used to manually test.
What issue is this related to, if any?
The issue is described in #398.