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

Windows authentication does not work #3

Closed
ialiashkevich opened this issue May 22, 2017 · 5 comments
Closed

Windows authentication does not work #3

ialiashkevich opened this issue May 22, 2017 · 5 comments

Comments

@ialiashkevich
Copy link

Windows 7 "Map Network Drive" fails with the "Invalid Parameter" popup.

The error happens as soon as SMBLibrary.Server.SMB2.SessionSetupHelper sends the STATUS_MORE_PROCESSING_REQUIRED response and socket connection is immediately closed by client.

@TalAloni
Copy link
Owner

Hi,
I was not able to recreate this, I tried with Windows 7 SP1 (no hot-fixes installed)
I can map and connect to the network drive successfully.
Is this error specific to mapping a network drive? are you able to connect when browsing to same UNC path?
Please try to assist me in uncovering the root cause of this issue.
For example, please try to test with a freshly installed Windows 7 SP1.

@ialiashkevich
Copy link
Author

I am running in corporate domain environment, cannot change my workstation.
But I serialized some objects to JSON and printed to debug output. I have two use-cases:
(Please let me know if I can provide some more information to assist you)

Use-Case #1: Mapping network drive from the same PC that runs SMBServer:

LogToServer: [169.254.190.77:21566] New connection request
LogToServer: [169.254.190.77:21566] Entering ProcessSendQueue
LogToServer: [169.254.190.77:21566] SMB2 request chain received: 1 requests, First request: Negotiate, Packet length: 108
LogToServer: [169.254.190.77:21566] SMB2 response chain queued: Response count: 1, First response: Negotiate, Packet length: 162
LogToServer: [169.254.190.77:21566] SMB2 request chain received: 1 requests, First request: SessionSetup, Packet length: 220
SessionSetupRequest: {"StructureSize":25,"Flags":0,"SecurityMode":1,"Capabilities":1,"Channel":0,"PreviousSessionId":0,"SecurityBuffer":[96,126,6,6,43,6,1,5,5,2,160,116,48,114,160,48,48,46,6,10,43,6,1,4,1,130,55,2,2,10,6,9,42,134,72,130,247,18,1,2,2,6,9,42,134,72,134,247,18,1,2,2,6,10,43,6,1,4,1,130,55,2,2,30,162,62,4,60,78,84,76,77,83,83,80,0,1,0,0,0,151,178,8,226,9,0,9,0,51,0,0,0,11,0,11,0,40,0,0,0,6,1,177,29,0,0,0,15,80,87,76,45,77,73,83,45,52,53,49,80,79,87,69,76,76,73,78,68],"Header":{"ProtocolId":[254,83,77,66],"StructureSize":64,"CreditCharge":1,"Status":0,"Command":1,"Credits":1,"Flags":0,"NextCommand":0,"MessageID":1,"Reserved":65279,"TreeID":0,"AsyncID":0,"SessionID":0,"Signature":null,"IsResponse":false,"IsAsync":false,"IsRelatedOperations":false,"IsSigned":false},"CommandLength":152,"CommandName":1,"Length":216}
NegotiateMessage: {"Signature":"NTLMSSP\u0000","MessageType":1,"NegotiateFlags":3792220823,"DomainName":"POWELLIND","Workstation":"PWL-MIS-451","Version":{"ProductMajorVersion":6,"ProductMinorVersion":1,"ProductBuild":7601,"NTLMRevisionCurrent":15}}
ChallengeMessage: {"MessageType":2,"NegotiateFlags":3800662549,"ServerChallenge":[75,163,125,16,85,158,35,217],"Signature":"NTLMSSP\u0000","TargetInfo":[2,0,18,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,1,0,22,0,80,0,87,0,76,0,45,0,77,0,73,0,83,0,45,0,52,0,53,0,49,0,4,0,26,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,46,0,80,0,82,0,73,0,3,0,50,0,80,0,87,0,76,0,45,0,77,0,73,0,83,0,45,0,52,0,53,0,49,0,46,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,46,0,80,0,82,0,73,0,5,0,26,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,46,0,80,0,82,0,73,0,7,0,8,0,240,221,248,181,242,211,210,1,0,0,0,0],"TargetName":"POWELLIND","Version":{"ProductMajorVersion":6,"ProductMinorVersion":1,"ProductBuild":7601,"NTLMRevisionCurrent":15}}
response(SMB2Command): {"StructureSize":9,"SessionFlags":0,"SecurityBuffer":[161,129,25,48,129,21,160,3,10,1,1,161,12,6,10,43,6,1,4,1,130,55,2,2,10,162,129,255,4,129,252,78,84,76,77,83,83,80,0,2,0,0,0,18,0,18,0,56,0,0,0,21,130,137,226,75,163,125,16,85,158,35,217,0,0,0,0,0,0,0,0,178,0,178,0,74,0,0,0,6,1,177,29,0,0,0,15,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,2,0,18,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,1,0,22,0,80,0,87,0,76,0,45,0,77,0,73,0,83,0,45,0,52,0,53,0,49,0,4,0,26,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,46,0,80,0,82,0,73,0,3,0,50,0,80,0,87,0,76,0,45,0,77,0,73,0,83,0,45,0,52,0,53,0,49,0,46,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,46,0,80,0,82,0,73,0,5,0,26,0,80,0,79,0,87,0,69,0,76,0,76,0,73,0,78,0,68,0,46,0,80,0,82,0,73,0,7,0,8,0,240,221,248,181,242,211,210,1,0,0,0,0,0,0],"Header":{"ProtocolId":[254,83,77,66],"StructureSize":64,"CreditCharge":0,"Status":3221225494,"Command":1,"Credits":0,"Flags":1,"NextCommand":0,"MessageID":1,"Reserved":0,"TreeID":0,"AsyncID":0,"SessionID":1,"Signature":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"IsResponse":true,"IsAsync":false,"IsRelatedOperations":false,"IsSigned":false},"CommandLength":293,"CommandName":1,"Length":357}
LogToServer: [169.254.190.77:21566] SMB2 response chain queued: Response count: 1, First response: SessionSetup, Packet length: 361
Exception thrown: 'System.Net.Sockets.SocketException' in System.dll
An existing connection was forcibly closed by the remote host

Use-Case #2: Mapping network drive from remote PC:
It fails with NullReference exception because SMB2ConnectionState.AuthenticationContext is NULL.

LogToServer: [172.18.10.20:55525] SMB2 request chain received: 1 requests, First request: Negotiate, Packet length: 108
LogToServer: [172.18.10.20:55525] Entering ProcessSendQueue
LogToServer: [172.18.10.20:55525] SMB2 response chain queued: Response count: 1, First response: Negotiate, Packet length: 162
LogToServer: [172.18.10.20:55525] SMB2 request chain received: 1 requests, First request: SessionSetup, Packet length: 2118
SessionSetupRequest: {"StructureSize":25,"Flags":0,"SecurityMode":1,"Capabilities":1,"Channel":0,"PreviousSessionId":0,"SecurityBuffer":[96,130,7,230,6,6,43,6,1,5,5,2,160,130,7,218,48,130,7,214,160,48,48,46,6,9,42,134,72,130,247,18,1,2,2,6,9,42,134,72,134,247,18,1,2,2,6,10,43,6,1,4,1,130,55,2,2,30,6,10,43,6,1,4,1,130,55,2,2,10,162,130,7,160,4,130,7,156,96,130,7,152,6,9,42,134,72,134,247,18,1,2,2,1,0,110,130,7,135,48,130,7,131,160,3,2,1,5,161,3,2,1,14,162,7,3,5,0,32,0,0,0,163,130,6,14,97,130,6,10,48,130,6,6,160,3,2,1,5,161,15,27,13,80,79,87,69,76,76,73,78,68,46,80,82,73,162,44,48,42,160,3,2,1,2,161,35,48,33,27,4,99,105,102,115,27,25,80,87,76,45,77,73,83,45,52,53,49,46,80,79,87,69,76,76,73,78,68,46,80,82,73,163,130,5,190,48,130,5,186,160,3,2,1,18,161,3,2,1,63,162,130,5,172,4,130,5,168,87,212,25,141,174,95,103,49,246,118,88,131,226,147,63,96,122,4,215,86,192,83,83,53,24,119,5,50,241,200,61,7,233,148,160,64,91,209,68,106,225,22,212,64,143,173,45,91,38,74,80,63,238,112,29,123,193,198,191,60,148,130,104,101,89,114,27,1,224,10,204,13,151,119,80,117,92,118,182,199,18,148,10,233,28,86,250,217,92,106,71,100,75,157,23,255,94,245,199,175,89,223,65,205,37,204,131,132,168,217,23,209,39,186,44,116,234,40,3,242,184,157,93,49,156,29,234,218,181,129,148,221,179,35,125,103,15,106,54,70,208,231,208,27,112,69,228,241,239,171,33,154,29,206,83,120,187,201,10,156,135,9,4,212,189,233,36,247,94,104,171,68,72,188,92,232,120,228,63,101,222,138,142,203,124,180,31,250,41,26,152,198,139,34,47,38,246,88,243,136,245,114,200,11,155,171,248,47,237,52,24,191,105,8,46,111,224,59,15,75,119,41,72,171,106,221,195,134,23,137,148,241,164,93,184,143,216,204,161,205,34,59,231,206,113,230,136,155,80,144,68,4,208,220,222,116,188,136,171,187,65,198,167,13,21,15,248,166,2,134,172,122,18,196,125,155,165,175,208,181,223,220,72,99,57,148,145,33,217,95,48,182,39,58,2,138,129,15,209,127,244,62,115,71,150,233,210,176,140,227,46,125,0,167,241,202,114,222,178,246,229,156,238,87,99,141,8,198,79,204,75,123,50,125,118,136,176,141,106,92,79,126,95,50,23,29,221,233,32,93,54,28,0,38,167,62,36,23,40,37,17,46,41,103,209,10,32,188,109,71,232,223,77,245,37,160,127,123,61,251,67,166,254,181,125,170,213,68,214,7,239,93,99,196,187,148,162,171,72,140,217,138,152,163,238,89,219,248,177,235,46,243,128,71,31,62,171,49,54,186,22,210,150,10,193,76,221,126,155,170,115,243,43,232,60,77,11,209,15,107,242,39,212,232,3,83,151,179,89,184,36,250,70,175,16,145,111,17,166,153,162,163,151,53,169,36,80,47,114,39,58,67,148,250,215,73,32,70,203,66,52,226,131,226,120,36,243,135,234,179,207,242,186,63,169,133,226,111,130,6,253,116,8,202,200,132,9,226,195,86,63,27,0,84,122,254,85,2,247,204,187,222,85,102,84,181,255,141,135,145,207,160,31,228,173,124,48,150,209,120,16,57,226,104,32,161,130,221,19,129,253,14,25,142,99,180,159,126,146,40,104,221,235,217,130,103,101,160,80,139,39,31,104,159,231,86,125,94,133,21,109,117,181,216,109,50,231,242,218,186,89,29,88,136,55,77,89,128,177,79,150,121,20,25,203,240,211,127,98,244,92,169,146,208,245,128,252,12,253,26,178,30,228,161,38,80,51,238,148,166,49,67,176,220,237,74,2,249,193,83,145,165,5,11,117,233,127,14,56,5,40,235,166,137,136,174,117,58,169,227,15,43,55,87,72,174,226,144,110,234,234,116,101,150,109,133,92,46,158,243,58,70,51,13,158,47,164,169,53,202,20,167,12,153,67,35,0,194,17,183,30,53,15,121,128,65,193,35,82,254,161,85,182,152,161,27,142,251,195,240,151,33,68,3,137,203,84,224,53,192,241,118,162,44,111,237,168,216,1,46,5,176,152,157,71,22,209,64,72,236,182,76,90,129,4,27,36,172,77,3,139,170,79,79,145,190,52,55,98,166,129,42,89,145,195,92,19,192,167,88,51,127,70,253,242,45,48,205,153,16,215,74,206,139,168,207,55,10,93,168,248,100,175,157,206,249,101,189,91,75,91,224,69,155,139,84,202,4,109,184,241,20,120,138,51,120,245,252,255,245,214,229,18,168,239,214,140,149,58,141,19,87,148,98,164,192,55,126,127,151,69,84,169,31,26,65,20,241,106,248,5,35,28,95,227,21,21,179,181,108,159,135,70,67,229,63,76,46,177,43,88,11,27,39,60,35,159,64,93,127,75,213,43,189,60,92,5,107,20,192,203,179,48,175,152,227,108,72,225,238,55,217,249,206,249,26,222,153,123,134,103,234,136,163,209,82,179,131,24,115,172,143,244,206,255,38,18,157,255,205,109,215,232,51,115,48,250,154,147,124,41,238,112,104,43,141,37,104,160,44,17,120,112,23,34,111,224,55,255,4,125,192,215,249,231,182,169,150,145,128,13,36,255,19,44,128,2,253,233,209,4,101,115,86,9,82,225,239,104,100,177,45,57,128,81,192,92,14,196,154,194,244,94,132,205,185,14,80,233,146,103,42,238,232,76,134,21,18,78,203,164,152,219,16,220,194,90,255,150,68,63,63,227,124,248,221,250,140,242,31,196,91,225,197,227,252,26,59,158,14,207,103,25,70,95,165,29,60,228,152,184,239,147,214,72,250,190,173,147,49,195,251,141,75,235,221,46,31,52,4,184,244,90,128,167,78,33,236,225,84,231,83,125,87,35,206,248,79,66,176,50,36,220,53,196,58,49,184,99,114,99,159,111,86,209,204,177,27,34,40,20,211,118,68,231,18,119,182,43,154,24,27,163,247,138,23,187,215,167,7,52,171,179,220,159,89,28,141,66,97,187,16,36,165,237,208,163,203,194,181,229,202,232,25,10,178,225,197,209,68,179,66,99,21,127,164,253,1,39,29,253,39,238,54,68,216,10,95,124,190,202,20,253,70,4,100,155,234,244,87,234,248,113,197,237,204,22,69,139,209,166,110,23,122,54,44,165,106,31,161,117,81,33,168,246,9,159,66,32,185,36,38,167,46,123,51,250,102,68,175,230,35,194,114,119,45,226,119,175,156,218,74,148,113,43,148,111,12,131,25,65,164,123,29,56,34,121,77,42,51,104,142,211,208,38,31,212,236,161,250,239,193,16,14,32,209,252,126,219,63,33,225,188,200,179,82,80,158,254,166,16,175,61,30,99,143,63,63,6,162,18,237,241,99,169,1,218,42,187,90,217,64,138,159,238,7,171,221,183,12,173,10,217,122,43,159,209,41,185,0,0,168,107,111,17,23,137,38,81,145,95,126,222,71,121,159,210,29,255,3,91,106,244,83,33,158,18,14,77,119,21,141,112,176,194,4,232,182,253,28,252,240,21,9,39,174,29,255,10,150,206,7,137,6,158,34,42,35,38,196,233,173,6,140,17,75,17,77,197,119,38,96,86,16,17,102,172,160,33,162,48,114,32,222,211,30,213,151,160,210,148,43,116,19,115,149,237,119,164,130,1,90,48,130,1,86,160,3,2,1,18,162,130,1,77,4,130,1,73,211,7,172,54,214,230,18,254,64,208,81,157,139,201,37,198,95,253,215,93,212,116,185,25,203,70,252,51,42,163,57,55,144,73,121,241,79,139,19,110,171,38,88,165,201,102,108,220,142,239,96,222,111,166,129,177,234,192,152,202,35,133,121,103,124,87,78,245,6,145,245,171,53,108,199,36,2,177,78,159,186,168,251,71,46,104,44,119,167,86,116,118,54,41,155,131,215,147,157,119,85,193,114,12,209,235,0,227,147,135,177,68,69,37,163,71,91,28,152,70,214,87,13,169,236,131,20,26,25,236,85,55,148,138,222,167,177,175,219,234,233,205,129,14,86,180,139,158,231,150,97,177,74,233,48,34,86,95,209,176,199,177,141,0,53,44,217,28,165,199,58,82,242,159,192,204,174,254,96,195,197,64,102,4,135,50,136,20,38,43,116,186,117,205,243,220,199,254,157,164,123,145,1,139,146,103,28,182,89,113,254,216,237,191,52,164,144,28,190,218,87,206,150,199,114,228,149,90,23,190,255,95,74,172,173,143,246,115,158,12,136,106,234,195,140,65,12,107,91,253,176,217,108,1,198,55,21,211,172,31,133,1,23,128,28,82,127,97,149,157,44,22,207,171,4,150,202,125,53,38,43,154,153,197,111,161,196,154,204,241,100,172,249,124,41,67,125,104,234,159,101,207,109,121,160,252,249,139,198,156,37,3,250,177,210,154,209,135,228,65,122,70,135,197,22,116,158,221,224],"Header":{"ProtocolId":[254,83,77,66],"StructureSize":64,"CreditCharge":1,"Status":0,"Command":1,"Credits":1,"Flags":0,"NextCommand":0,"MessageID":1,"Reserved":65279,"TreeID":0,"AsyncID":0,"SessionID":0,"Signature":null,"IsResponse":false,"IsAsync":false,"IsRelatedOperations":false,"IsSigned":false},"CommandLength":2050,"CommandName":1,"Length":2114}

Please let me know if I can provide some more information to assist you.

@TalAloni
Copy link
Owner

Thanks for the detailed logs, they have been very helpful.
I was able to identify two issues with my authentication code, and I have committed the necessary fixes.

I was not able to properly test some of the updated code (and not for lack of trying), so it would be very helpful if you could test the two use-cases (against the updated code) and report back.

@TalAloni
Copy link
Owner

TalAloni commented Jun 5, 2017

I was able to recreate this today and I have made the necessary corrections to the authentication code.

@TalAloni
Copy link
Owner

TalAloni commented Jun 8, 2017

The corrections are included in v1.2.0

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

No branches or pull requests

2 participants