Search code examples
securityauthenticationmetamask

Is recovering a signed message a secure login procedure?


Is the following login procedure secure?

  1. Sign a message on the server
  2. Send it to the client
  3. Sign the message with metamask
  4. Send the signature back
  5. Recover the account from the signature and signed message
  6. Use the recovered address as id

What are the most common vulnerabilities i'd run into using this concept?


Solution

  • The concept on a very high level is valid, but implementation details are key. Consider replay attacks for example, an attacker should not be able to use a previous signed reply. Also consider a mitm: server sends challenge, attacker forwards it to client, client signs it, sends it to attacker, now attacker can authenticate and impersonate the victim. This means it needs a secure channel where the client already authenticated the server (ie. https). And so on, there is a lot of detail in how this is implemented that matters.

    Also note that this about what webauthn does.