This repository was archived by the owner on Mar 19, 2019. It is now read-only.
This repository was archived by the owner on Mar 19, 2019. It is now read-only.
Memory leak in WebListener when using NTLM #317
Closed
Description
Memory leak occurs in lsass.exe process when using WebListener (.NET Core 1.1). Authentication scheme must be set to AuthenticationSchemes.NTLM
.
Client is sending requests using System.Net.HttpClient
(.NET 4.6) with credentials set to CredentialCache.DefaultCredentials
.
Client and server must be on different machines.
Server:
public class Program
{
public static void Main(string[] args)
{
var builder = new WebHostBuilder()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.UseUrls($"http://+:8080")
.UseWebListener(options =>
{
options.ListenerSettings.Authentication.Schemes = AuthenticationSchemes.NTLM;
options.ListenerSettings.Authentication.AllowAnonymous = false;
});
var host = builder.Build();
host.Run();
}
}
Client:
public class Program
{
private static string _url;
private static HttpClient _client;
public static void Main(string[] args)
{
_client = new HttpClient(new HttpClientHandler
{
Credentials = CredentialCache.DefaultCredentials
});
_url = "http://192.166.1.122:8080/";
try
{
for (int i = 0; i < 10000; i++)
using (HttpResponseMessage response = _client.GetAsync(_url).Result)
Console.WriteLine($"StatusCode: {response.StatusCode}");
}
catch (Exception e)
{
Console.WriteLine(e);
}
}
}
Sample solution attached:
WebListenerNtlmLsassMemoryLeak.zip