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

NTLMv2 with MAC and EPA support #35

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

dlorych
Copy link

@dlorych dlorych commented Jul 20, 2022

NTLMv2 with MAC and channel binding support

I had trouble using library in my environment, but finally managed to solve it by refactoring code to follow NTLMv2 standard according to
NTLM protocol description, in particular:

  • added support for MIC
  • added missing target info (avPairs) updates
  • added support for CBT (channel binding tokens)
  • zeroed version by default

Connection against secured IIS (NTLMv2 and enabled EPA) is working in my environment, but there's a hight risk that it can break in a different environment, especially ones that do no support NTLMv2 fully.

Could anyone assess the changes and test in their environment?

@ghost
Copy link

ghost commented Jul 20, 2022

CLA assistant check
All CLA requirements met.

@dlorych dlorych closed this Jul 20, 2022
@dlorych dlorych reopened this Jul 20, 2022
@dlorych dlorych closed this Jul 20, 2022
@dlorych dlorych changed the title NTLMv2 with MAC and EPA support NTLMv2 with MAC and EPA support [to be removed] Jul 20, 2022
@dlorych dlorych reopened this Jul 20, 2022
@dlorych
Copy link
Author

dlorych commented Jul 20, 2022

@paulmey I'm trying to delete the contents of this PR - wrong author. Could you help me out with it?

@dlorych dlorych closed this Jul 20, 2022
NTLMv2 `authenticate` messages are expected to include MIC field.
MIC is a hash of 3 concatenated exchanged messages (`negotiate`, `challenge` and `authenticate`)
As a MIC field is part of the `authenticate` message, during a calculation the field is expected to be filled out with zeroes.
Once calculated the value is back-filled inside the `authenticate` byte array.
NTLMv2 is expected to fill out information about the remote server
in a form of SPN value in a AvTargetName AvPair field.

Extracted `getTimestamp` function and added a comment on the
structure of the timestamp byte array.
Add AvPairs type to handle (un-)marshalling

Extract logic of updating target info values to separate funtion

Add SPN target info field - necessary with for Extended Protection
for Authentication (WIP - to fully support Channel Binding Token is
necessary).
EPA Extended Security for Authentication is based on adding channel
binding token (CBT) to `authenticate` message (TargetInfo AvPair
structure)
- Move defaultFlags to negotiation_flags.go file
- Change `defaultFlags` to follow [MS-NLMP] documentation
- Modify "negotiation", so it is composed of shared part, with
  exception of EXTENDED_SESSIONSECURITY, which shall be enabled always
@dlorych dlorych reopened this Jul 21, 2022
@dlorych dlorych closed this Jul 21, 2022
@dlorych dlorych reopened this Jul 22, 2022
@dlorych dlorych changed the base branch from master to dev July 22, 2022 07:12
@dlorych dlorych changed the base branch from dev to master July 22, 2022 07:12
@dlorych dlorych changed the base branch from master to dev July 22, 2022 07:52
@dlorych dlorych changed the base branch from dev to master July 22, 2022 07:52
@dlorych dlorych closed this Jul 22, 2022
@dlorych dlorych reopened this Jul 22, 2022
@dlorych dlorych changed the title NTLMv2 with MAC and EPA support [to be removed] NTLMv2 with MAC and EPA support Jul 22, 2022
@dlorych
Copy link
Author

dlorych commented Jul 22, 2022

@paulmey I managed to solve the authorship issues. Feel free to review PR and suggest changes.

@mrowken
Copy link

mrowken commented Sep 5, 2022

Hi, I have used that version from @dlorych and it works well for me in adcs-issuer (for cert-manager) with NTLMv2.
Do you think it will be merged ? When ?

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

Successfully merging this pull request may close these issues.

2 participants