Honestly, solving this “problem” will be more problems than it costs.
Saving user passwords in strings cannot be prevented by using technologies such as ASP.NET, unless you intend to encrypt strings on the client side before sending them, because ASP.NET will store them as strings in form collections, etc.
And if you went along the JS encryption route, note that any potential attacker will also be able to decrypt the strings that he recovered from your application.
However, if someone breaks into a web server, there is a chance that he could compromise the entire database. And this is much worse than collecting multiple passwords from a heap of a web server ...
Now, if this is not an ASP.NET application, and you have full control over how passwords are processed in code, you can take a look at SecureString . But you can still find that the minimal benefits outweigh the increased code complexity. It really depends on how bad the password leak will be, and how vulnerable your computers are to compromise in the first place. If you are not worried that any remote attacker will be able to debug your processes and receive snapshots of memory, this is really not a problem.
In short: if an attacker has the ability to extract these lines from a memory or swap , he also has the right to do things that are much worse .
cdhowie
source share