Search code examples
csecuritywinapicrash-dumpswinlogon

Plaintext password protection on crash dump


We need to specify plain text passwords with some APIs like LogonUser, NetUseAdd and others. We may protect the password by keeping it encrypted in memory, and assign a plaintext password just before calling the function (into lpszPassword parameter in case of LogonUser, or USE_INFO_2::ui2_username in case of NetUseAdd).

My question is how to protect the plaintext password from external process, especially when this process might crash and produce a memory dump.

It should be like:

  1. Protect-this-memory-area
  2. Call secure function requiring plaintext password
  3. Dismiss-protection-of-memory-area
  4. Clean-memory-area

Solution

  • You need to protect the memory dump itself. This is why some systems have them disabled entirely, some have them written to a special place which is not readable by mere mortals, etc.