diff --git a/SMBLibrary/Authentication/NTLM/Helpers/AuthenticationMessageUtils.cs b/SMBLibrary/Authentication/NTLM/Helpers/AuthenticationMessageUtils.cs index 468aa12..7df1f12 100644 --- a/SMBLibrary/Authentication/NTLM/Helpers/AuthenticationMessageUtils.cs +++ b/SMBLibrary/Authentication/NTLM/Helpers/AuthenticationMessageUtils.cs @@ -59,18 +59,18 @@ namespace SMBLibrary.Authentication.NTLM } /// - /// If NTLM v1 Extended Security is used, LMResponse starts with 8-byte challenge, followed by 16 bytes of padding (set to zero). + /// If NTLM v1 Extended Session Security is used, LMResponse starts with 8-byte challenge, followed by 16 bytes of padding (set to zero). /// /// - /// LMResponse is 24 bytes for NTLM v1, NTLM v1 Extended Security and NTLM v2. + /// LMResponse is 24 bytes for NTLM v1, NTLM v1 Extended Session Security and NTLM v2. /// - public static bool IsNTLMv1ExtendedSecurity(byte[] lmResponse) + public static bool IsNTLMv1ExtendedSessionSecurity(byte[] lmResponse) { if (lmResponse.Length == 24) { if (ByteUtils.AreByteArraysEqual(ByteReader.ReadBytes(lmResponse, 0, 8), new byte[8])) { - // Challenge not present, cannot be NTLM v1 Extended Security + // Challenge not present, cannot be NTLM v1 Extended Session Security return false; } return ByteUtils.AreByteArraysEqual(ByteReader.ReadBytes(lmResponse, 8, 16), new byte[16]); @@ -79,7 +79,7 @@ namespace SMBLibrary.Authentication.NTLM } /// - /// NTLM v1 / NTLM v1 Extended Security NTResponse is 24 bytes. + /// NTLM v1 / NTLM v1 Extended Session Security NTResponse is 24 bytes. /// public static bool IsNTLMv2NTResponse(byte[] ntResponse) { diff --git a/SMBLibrary/Authentication/NTLM/Helpers/NTLMCryptography.cs b/SMBLibrary/Authentication/NTLM/Helpers/NTLMCryptography.cs index eb3c1fe..5dcdc2e 100644 --- a/SMBLibrary/Authentication/NTLM/Helpers/NTLMCryptography.cs +++ b/SMBLibrary/Authentication/NTLM/Helpers/NTLMCryptography.cs @@ -28,7 +28,7 @@ namespace SMBLibrary.Authentication.NTLM return DesLongEncrypt(hash, challenge); } - public static byte[] ComputeNTLMv1ExtendedSecurityResponse(byte[] serverChallenge, byte[] clientChallenge, string password) + public static byte[] ComputeNTLMv1ExtendedSessionSecurityResponse(byte[] serverChallenge, byte[] clientChallenge, string password) { byte[] passwordHash = NTOWFv1(password); byte[] challengeHash = MD5.Create().ComputeHash(ByteUtils.Concatenate(serverChallenge, clientChallenge)); diff --git a/SMBLibrary/Authentication/NTLM/IndependentNTLMAuthenticationProvider.cs b/SMBLibrary/Authentication/NTLM/IndependentNTLMAuthenticationProvider.cs index 539572c..dd8e2ea 100644 --- a/SMBLibrary/Authentication/NTLM/IndependentNTLMAuthenticationProvider.cs +++ b/SMBLibrary/Authentication/NTLM/IndependentNTLMAuthenticationProvider.cs @@ -194,9 +194,9 @@ namespace SMBLibrary.Authentication.NTLM byte[] keyExchangeKey = null; if ((message.NegotiateFlags & NegotiateFlags.ExtendedSessionSecurity) > 0) { - if (AuthenticationMessageUtils.IsNTLMv1ExtendedSecurity(message.LmChallengeResponse)) + if (AuthenticationMessageUtils.IsNTLMv1ExtendedSessionSecurity(message.LmChallengeResponse)) { - // NTLM v1 Extended Security: + // NTLM v1 Extended Session Security: success = AuthenticateV1Extended(password, serverChallenge, message.LmChallengeResponse, message.NtChallengeResponse); if (success) { @@ -314,12 +314,12 @@ namespace SMBLibrary.Authentication.NTLM } /// - /// LM v1 / NTLM v1 Extended Security + /// LM v1 / NTLM v1 Extended Session Security /// private static bool AuthenticateV1Extended(string password, byte[] serverChallenge, byte[] lmResponse, byte[] ntResponse) { byte[] clientChallenge = ByteReader.ReadBytes(lmResponse, 0, 8); - byte[] expectedNTLMv1Response = NTLMCryptography.ComputeNTLMv1ExtendedSecurityResponse(serverChallenge, clientChallenge, password); + byte[] expectedNTLMv1Response = NTLMCryptography.ComputeNTLMv1ExtendedSessionSecurityResponse(serverChallenge, clientChallenge, password); return ByteUtils.AreByteArraysEqual(expectedNTLMv1Response, ntResponse); } diff --git a/SMBLibrary/Authentication/NTLM/Structures/AuthenticateMessage.cs b/SMBLibrary/Authentication/NTLM/Structures/AuthenticateMessage.cs index f524006..b09ffed 100644 --- a/SMBLibrary/Authentication/NTLM/Structures/AuthenticateMessage.cs +++ b/SMBLibrary/Authentication/NTLM/Structures/AuthenticateMessage.cs @@ -20,8 +20,8 @@ namespace SMBLibrary.Authentication.NTLM public string Signature; // 8 bytes public MessageTypeName MessageType; - public byte[] LmChallengeResponse; // 1 byte for anonymous authentication, 24 bytes for NTLM v1, NTLM v1 Extended Security and NTLM v2. - public byte[] NtChallengeResponse; // 0 bytes for anonymous authentication, 24 bytes for NTLM v1 and NTLM v1 Extended Security, >= 48 bytes for NTLM v2. + public byte[] LmChallengeResponse; // 1 byte for anonymous authentication, 24 bytes for NTLM v1, NTLM v1 Extended Session Security and NTLM v2. + public byte[] NtChallengeResponse; // 0 bytes for anonymous authentication, 24 bytes for NTLM v1 and NTLM v1 Extended Session Security, >= 48 bytes for NTLM v2. public string DomainName; public string UserName; public string WorkStation; diff --git a/SMBLibrary/Server/SMB1/SessionSetupHelper.cs b/SMBLibrary/Server/SMB1/SessionSetupHelper.cs index 3f81b77..7bbdb2a 100644 --- a/SMBLibrary/Server/SMB1/SessionSetupHelper.cs +++ b/SMBLibrary/Server/SMB1/SessionSetupHelper.cs @@ -149,7 +149,7 @@ namespace SMBLibrary.Server.SMB1 NegotiateFlags.Version | NegotiateFlags.Use128BitEncryption | NegotiateFlags.Use56BitEncryption; - if (AuthenticationMessageUtils.IsNTLMv1ExtendedSecurity(lmChallengeResponse) || + if (AuthenticationMessageUtils.IsNTLMv1ExtendedSessionSecurity(lmChallengeResponse) || AuthenticationMessageUtils.IsNTLMv2NTResponse(ntChallengeResponse)) { authenticateMessage.NegotiateFlags |= NegotiateFlags.ExtendedSessionSecurity; diff --git a/SMBLibrary/Tests/NTLMSigningTests.cs b/SMBLibrary/Tests/NTLMSigningTests.cs index 563d3ed..afcf870 100644 --- a/SMBLibrary/Tests/NTLMSigningTests.cs +++ b/SMBLibrary/Tests/NTLMSigningTests.cs @@ -94,7 +94,7 @@ namespace SMBLibrary return ByteUtils.AreByteArraysEqual(mic, expected); } - public static bool TestNTLMv1ExtendedSecurityKeyExchangeMIC() + public static bool TestNTLMv1ExtendedSessionSecurityKeyExchangeMIC() { string password = "Password"; byte[] type1 = new byte[] { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00, 0x97, 0x82, 0x08, 0xe2,