aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Robertson <Kevin-Robertson@users.noreply.github.com>2022-01-09 18:24:01 -0500
committerKevin Robertson <Kevin-Robertson@users.noreply.github.com>2022-01-09 18:24:01 -0500
commit8c765f19c54f204afa113d345c20d5d420a6e850 (patch)
tree1a6a6936fc1e0f6ddca2cae68813d985a62ff132
parenteaf0227782e0d567447b639cebf2235a2ee71c0c (diff)
downloadInveigh-8c765f19c54f204afa113d345c20d5d420a6e850.tar.gz
Inveigh-8c765f19c54f204afa113d345c20d5d420a6e850.zip
Update HTTPListener.cs
Fix for Negotiate auth
-rw-r--r--Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs23
1 files changed, 16 insertions, 7 deletions
diff --git a/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs
index f31e8e4..2587e90 100644
--- a/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs
+++ b/Inveigh/Protocols/Quiddity/Quiddity/Listeners/HTTPListener.cs
@@ -174,7 +174,7 @@ namespace Quiddity
while (tcpClient.Connected && isRunning)
{
- byte[] requestData = new byte[4096];
+ byte[] requestData = new byte[16384];
if (type.Equals("HTTPS"))
{
@@ -234,7 +234,7 @@ namespace Quiddity
}
}
-
+
HTTPRequest request = new HTTPRequest();
if (!Utilities.ArrayIsNullOrEmpty(requestData))
@@ -291,7 +291,7 @@ namespace Quiddity
}
}
-
+
if (type.Equals("Proxy"))
{
response.StatusCode = "407";
@@ -322,7 +322,7 @@ namespace Quiddity
response.WWWAuthenticate = string.Concat("Basic realm=", HTTPRealm);
}
- if ((!string.IsNullOrEmpty(request.Authorization) && request.Authorization.ToUpper().StartsWith("NTLM ")) || (!string.IsNullOrEmpty(request.ProxyAuthorization)) && request.ProxyAuthorization.ToUpper().StartsWith("NTLM "))
+ if (!string.IsNullOrEmpty(request.Authorization) && (request.Authorization.ToUpper().StartsWith("NTLM ") || request.Authorization.ToUpper().StartsWith("NEGOTIATE ")) || (!string.IsNullOrEmpty(request.ProxyAuthorization)) && request.ProxyAuthorization.ToUpper().StartsWith("NTLM "))
{
string authorization = request.Authorization;
@@ -332,7 +332,7 @@ namespace Quiddity
}
NTLMNegotiate ntlm = new NTLMNegotiate();
- ntlm.ReadBytes(Convert.FromBase64String(authorization.Substring(5, authorization.Length - 5)), 0);
+ ntlm.ReadBytes(Convert.FromBase64String(request.Authorization.Split(' ')[1]), 0);
if (ntlm.MessageType == 1)
{
@@ -351,7 +351,16 @@ namespace Quiddity
}
else
{
- response.WWWAuthenticate = "NTLM " + Convert.ToBase64String(challengeData);
+
+ if (request.Authorization.ToUpper().StartsWith("NEGOTIATE "))
+ {
+ response.WWWAuthenticate = "Negotiate " + Convert.ToBase64String(challengeData);
+ }
+ else
+ {
+ response.WWWAuthenticate = "NTLM " + Convert.ToBase64String(challengeData);
+ }
+
}
response.Connection = "";
@@ -362,7 +371,7 @@ namespace Quiddity
response.ReasonPhrase = "OK";
ntlmStage = 3;
isClientClose = true;
- NTLMResponse ntlmResponse = new NTLMResponse(Convert.FromBase64String(authorization.Substring(5, authorization.Length - 5)), false);
+ NTLMResponse ntlmResponse = new NTLMResponse(Convert.FromBase64String(authorization.Split(' ')[1]), false);
string domain = Encoding.Unicode.GetString(ntlmResponse.DomainName);
string user = Encoding.Unicode.GetString(ntlmResponse.UserName);
string host = Encoding.Unicode.GetString(ntlmResponse.Workstation);