Description
HttpClient leaves information about requests in a memory dump, for example, Post content is visible in plain text. Object disposal does not help, response is not assigned to any long-living global variable. Even tried to call the Garbage collector explicitly, but the result is the same.
It is an issue because memory dump could be collected without admin permission and theoretically some malicious service could collect sensitive data from request/response content.
Reproduction Steps
- Build a simple app that does HttpRequest. For example, I used a console app, but overall there is no difference:
using System.Text;
namespace HttpClientTestApp
{
internal class Program
{
static async Task Main(string[] args)
{
using (HttpClient client = new HttpClient())
{
var url = "http://ptsv3.com/t/55/post/";
var content = new StringContent("{\"key\":\"ValueNotExpectedInMemoryDump\"}", Encoding.UTF8, "application/json");
await client.PostAsync(url, content);
}
Console.ReadLine();
}
}
}
- Launch the app and collect its memory dump. I just went to Windows task manager, found my process, right-clicked on it and chose Create memory dump file.
- Open the memory dump file with your preferred text editor and try to search for content value. In example code case: ValueNotExpectedInMemoryDump
Expected behavior
Where should there be no info about request/response content
Actual behavior
You can find info about request/response content in plain text
Regression?
Managed to achieve the same result with .NET 7 and .NET 8. Didn't try older versions.
Operating system used: Windows 10 and Windows 11, I think the build of Windows is not important.
Known Workarounds
No response
Configuration
No response
Other information
No response
Description
HttpClient leaves information about requests in a memory dump, for example, Post content is visible in plain text. Object disposal does not help, response is not assigned to any long-living global variable. Even tried to call the Garbage collector explicitly, but the result is the same.
It is an issue because memory dump could be collected without admin permission and theoretically some malicious service could collect sensitive data from request/response content.
Reproduction Steps
Expected behavior
Where should there be no info about request/response content
Actual behavior
You can find info about request/response content in plain text
Regression?
Managed to achieve the same result with .NET 7 and .NET 8. Didn't try older versions.
Operating system used: Windows 10 and Windows 11, I think the build of Windows is not important.
Known Workarounds
No response
Configuration
No response
Other information
No response