w3c / webappsec-credential-management

WebAppSec Credential Management
https://w3c.github.io/webappsec-credential-management/
Other
49 stars 38 forks source link

Find a way to avoid exposing a user password to the web page #96

Open dbates-wk opened 7 years ago

dbates-wk commented 7 years ago

(Let me know if this issue would be more appropriate to discuss in the context of the Web Authentication spec.)

It would be great if the Credential Management spec. had guarantees that it would never expose the user's password to the web page or web server. If we made that a hard constraint can we come up with a solution?

I have not thought this through completely. Could the keychain management aspects of the Credential Management API be combined with an implementation of a Secure Remote Password protocol and the concept of an opaque password field to avoid the need to ever expose the actual password to the web page/web server?

dbates-wk commented 7 years ago

CC @mikewest

mikewest commented 7 years ago

Could the keychain management aspects of the Credential Management API be combined with an implementation of a Secure Remote Password protocol and the concept of an opaque password field to avoid the need to ever expose the actual password to the web page/web server?

This seems like a laudable goal. Do y'all have some concrete ideas?

Off the top of my head, I can imagine something that hashes a challenge and the password locally, even a really naive approach like:

navigator.credentials.get({
    'hashedPassword': { 'challenge': 'abcdefg', 'count': 10000 }
}).then(c => {
    // `c` is an `HashedPassword` object containing: {
    //    'challenge': 'abcdefg',
    //    'response': PBKDF2('abcdefg', password, 10000)
    //  }
});

A problem, though, is that this scheme would require the server to have plaintext access to the password in order to verify the hash (if they stored only hashed password in their local database, they wouldn't be able to combine the pasword with the challenge in any reasonable way). That might actually be worse than status quo, where the server could only have access in the context of a POST response.

I'd be really interested in hearing other ideas that might mitigate that risk. Maybe we could support a particular hashing mechanism and have the server pass in enough information for us to replicate it client-side? (e.g. sha256(hashAlgorithm(options, options, options, password) + challenge))?

CC @battre @hillbrad

battre commented 7 years ago

Instead of storing the password, the website could store a hash of the password and ask to provide PBKDF2('abcdefg', hash(password), 10000), right?

Another, much more fancy approach would be around zero-knowledge proofs. Paul Crowley pointed me to http://grouper.ieee.org/groups/1363/passwdPK/contributions.html and suggested PAK-Z+ (or a post-quantum secure version) as a zero-knowledge proof of knowing credentials. Full disclaimer: I have not studied this material so the following may be wrong. My understanding is that the user would not type the password into a website but into a native password dialog. Even if I type my google password into the naive dialog of phishing.com, nothing bad would happen.

But frankly, I think this is a gradual process. I don't think that we get very far if we expect sites to rebuild their entire auth infrastructure in one step.

dbates-wk commented 7 years ago

CC @johnwilander

mikewest commented 7 years ago

Ping? I think this is an interesting conversation; it'd be good if we could continue it. :)

dbates-wk commented 7 years ago

I have not had a chance to finish reading the existing literature on the Secure Remote Password protocol and zero-knowledge proofs. From my initial readings into these topics they seem the most applicable to support authentication without exposing credentials. It would be great if someone more familiar with these topics would be willing to give a presentation on them and/or help determine the feasibility of integrating them into a web browser.

dbates-wk commented 7 years ago

But frankly, I think this is a gradual process. I don't think that we get very far if we expect sites to rebuild their entire auth infrastructure in one step.

I hope that we can come up with a solution that minimizes the server-side implementation effort. I am willing to trade requiring web site operators to put more effort than the status quo when it comes to transmission of a user's password in exchange for a secure and great user experience. I suspect web site operators will be willing to make such an investment if the benefits are the following:

battre commented 7 years ago

Apologies for the radio silence... Summer vacation and moving...

Do I see it correct that the necessary components for this would be:

  1. a mechanism to fully opt-out of autofill based password management
  2. a mechanism to proof knowledge of the password to the server
  3. a mechanism to enter passwords into native UI

For 1., I am thinking of something along the lines of HSTS that opts out on the full domain (and probably other sub-domains). Without that, the site risks that any non-protected site gets a password form injected via XSS that discloses the password on autofill.

For 2., we probably need something more advanced than the algorithm proposed above to protect against phishing and active network attacks.

For 3., we need to think of the bootstrapping. How do we deal with getting the credentials into the system? How do we deal with the set of users that don't want to store passwords in a password manager? I think this has to be non-spoofable native UI, which may cause some resistance from sites and users.

Advantages of this approach

Issues of the approach

I think that the Password-Based Public-Key Cryptography work can address the XSS, active network and phishing attacks. But then the question is whether the effort for websites to implement the algorithms and the fact that users need to enter their credentials into native UI become prohibitive.

backkem commented 6 years ago

I feel the recent Twitter debacle illustrates the need for this type of mechanism. Some thoughts: