Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

[Question] Passwords should not be of type String ? #2051

Closed
ycrumeyrolle opened this issue Nov 1, 2018 · 3 comments
Closed

[Question] Passwords should not be of type String ? #2051

ycrumeyrolle opened this issue Nov 1, 2018 · 3 comments

Comments

@ycrumeyrolle
Copy link

My security team escalated to me that the PasswordHasher is vulnerable to heap inspection, as the password is of type String.
It should be instead a byte array / span of bytes cleared at the end of the process, as it is done by any cryptographic operation in corefx. CC @bartonjs.
Same problem with any password related types (IPasswordValidator, and maybe also the IUserPasswordStore)

@ycrumeyrolle ycrumeyrolle changed the title Passwords should not be of type String [Question] Passwords should not be of type String ? Nov 1, 2018
@blowdart
Copy link
Member

blowdart commented Nov 1, 2018

So .. yes but ...

When the passwords are delivered over an HTTP request they're strings. You can pretend to add safety by turning them into a byte array, but it doesn't add anything, they've been strings already, now you have them represented in two places. It's the same problem SecureString has, byte arrays are only useful if you control the input mechanism.

So sure, in theory yes, in practice it adds nothing.

@blowdart blowdart closed this as completed Nov 1, 2018
@ycrumeyrolle
Copy link
Author

But what if I am controlling the input mechanism?
In my case, password is a PIN typed on a randomized virtual keyboard. The http request just has the position on the keyboard, not the value. After decoding the position, I am able to provide a byte array without passing by a string.

@blowdart
Copy link
Member

blowdart commented Nov 2, 2018

Then you're way outside what we expect identity to be used for.

Also, if an attacker is at the point where they can execute code to start dumping memory they're at the point where they can run anything on your server, so they can intercept requests, change responses, connect to your database and so on. This is solved by hardening your infrastructure, not by changing strings to byte arrays.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants