Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hows does one prevent passwords and other sensitive information from appearing in an ASP.NET dump?

How does one prevent passwords and other sensitive data submitted to and received from ASP.NET web pages in IIS/ASP.NET dump files?

Steps to reproduce

  1. Using Visual Studio 2010, create a ASP.NET MVC 3 intranet application.
  2. Configure it to use IIS 7.5.
  3. Fire it up and register an account (say bob123 as the user and Pa$$w0Rd as the password. I'm assuming that the SQL Express database is created and the site is fully functional.
  4. Using task manager, right click on the w3wp process and create a dump.
  5. Open the dump in an editor capable of displaying its contents as hex, such as SlickEdit.
  6. Search for "Pa$$0Rd" and "Pa%24%24w0Rd" in the hex dump. You should be able to find several copies of it stored as ASCII, Unicode, or encoded.

Note that it doesn't matter whether you use HTTPS because it only encrypts the communication. ASP.NET stores that data in the clear in memory or disk.

The problem

Common wisdom has it to encrypt sensitive data and not to store it in the clear. However an employee may receive a dump of an IIS/ASP.NET application and discover passwords and other confidential data of users because this information is neither encrypted, nor is memory used by ASP.NET cleared after usage.

This puts them at risk simply because they have access to it. Dump are sometimes shared with partners (such as Microsoft) to help them diagnose issues in their code. It is a necessary part of diagnosing some really complex problems in one's application.

Things I looked at

  1. Use SecureString for passwords and other sensitive data. However, the ASP.NET Membership provider, along with other frameworks like WCF, often accepts passwords as System.String, which means that those copies will still be in the dump.
  2. Looked to see if there is anything in the framework to clear out a copy of System.String when it is no longer being used. I couldn't find anything.
  3. Investigated whether one can zero out the memory used for requests and responses once IIS is done with it, but I was unable to find anything.
  4. I investigated wether one can encrypt files IIS receives (as HttpPostFile) so that they are not stored in the clear. We may receive documents that are extremely confidential and every step is made to encrypt and protect them on the server. However, someone can extract them in the clear from an IIS dump.

What I was hoping for is to tell IIS/ASP.NET that a specific request/response contains sensitive data and that IIS/ASP.NET will clear out the memory when it is done using it.

like image 332
bloudraak Avatar asked Apr 01 '12 12:04

bloudraak


People also ask

What is sensitive data exposure owasp?

Sensitive data exposure occurs when an application accidentally exposes sensitive data. This differs from a data breach, in which an attacker accesses and steals information. Sensitive data exposure usually occurs when we fail to adequately protect the information in the database.

How does .NET core store sensitive data?

The idea is simple: All the base configuration should be placed on the appsettings. json file. Then, you can add environment-specific configuration by creating additional configuration files where the name of each file contains the environment name they belong to, i.e. appsettings. development.


1 Answers

A dump file by definition dumps all the memory the application uses at the moment it is dumped, If you were to create a filter so that certain things were excluded then you could never be sure that you had enough data to zero in on a problem.

Would you be comfortable handing over your databases / configuration settings to a third party? if not then you probably shouldn't be handing over dumpfiles either. (imho)

like image 131
AndreasKnudsen Avatar answered Sep 26 '22 08:09

AndreasKnudsen