Conversation
The eth_sign method has been considered insecure for a long time, because it allows signing arbitrary data blobs, which can leak personal information, and be used to sign transactions without the usual approval process. We have long implemented the preferred alternative as personal_sign, which is actually not the same as any other client. For both security and cross-client compatibility, this change brings eth_sign up to the same behavior as personal_sign, without deprecating that method, again for retroactive compatibility. Fixes #2215
1bc26bc to
a9d3686
Compare
|
Once caveat, this now displays data passed in to Maybe we could merge #4039 in with this as well? |
|
Forcing a user to see hex seems like a good way for an attacker to obscure a challenge provided by another site, so I'm not sure this should be rolled together with #4039. |
|
@danfinlay good point. Maybe we can make hex display optional if and only if the data being signed is a valid 32 byte hex string. This greatly reduces the attack surface for obfuscating challenges. Personally I think the ultimate solution is for the client application to send a list of items and their ABI encoding to MM I know this has been hashed out every which way, but this proposal is backwards-compatible for almost all contracts, much nicer for users, and has a significantly reduced attack surface. |
|
Hey @FlySwatter as we discussed earlier I would prefer if this is not merged in until EIP712 is finalized. Right now the signed messages conforming to EIP191 (for instance in simple-multisig) cannot be signed using Metamask if Metamask forces the prefix. Ideally these kinds of offline signed messages should be using EIP712 but since that has not been finalized we're in a bit of a limbo. EIP712 does look like it's in pretty good shape though so hopefully will be finalized soon. |
|
Marking DONOTMERGE until we finalize EIP712 for those reasons. |
|
@danfinlay How are we looking for this to be merged now that EIP712 has been merged? One thing I have noticed is the inconsistencies with It also appears that the MM Trezor integration only supports It would be a happy day when we can truly be agnostic to the underlying |
|
@danfinlay If the hesitation with changing
It's a bit of a dance, but if Metamask doesn't make this change, everyone building ontop of it will need to implement some hacky solution (e.g Ethers.js Web3 Provider: https://github.com/ethers-io/ethers.js/blob/master/providers/web3-provider.js#L54) which introduces new bugs, like the one @dekz mentioned about some hashes becoming unsignable b/c of the forced UTF8 encoding/decoding in |
|
I would also suggest just dropping eth_sign support since it has had such a shaky history of changing specs and incompatible implementations |
|
@kumavis that would make Metamask inconsistent with every other provider. Perhaps its worth just discussing all the things that are a problem with I would suggest modifying the Other tools and libraries are required to write work arounds for Metamask since it is different from other providers. E.g Ethers.js, 0x.js. I think we can all agree that this is a problem. For reference in this discussion, here is what is defined in the JSON RPC interface for So it takes in This is how Trezor and Ledger both operate, where they prefix on the device itself. If your concern is breaking dApps that are requiring signed hashes without a prefix then perhaps you can migrate them to
I'll be at devcon and @ricmoo and @fabioberger and I plan on setting aside some time to discuss Providers in general and a compliance test suite. We'd love for you to attend as well. |
|
For now, this implementation of For those reasons of non-breaking and reduced security concerns, we are closing for now. Petitions to change this behavior should be discussed in #2215. |
|
This is so fascinating and i wish someone could break it down to help me understand so i can finally do this myself... |

The eth_sign method has been considered insecure for a long time,
because it allows signing arbitrary data blobs, which can leak personal
information, and be used to sign transactions without the usual approval
process.
We have long implemented the preferred alternative as personal_sign,
which is actually not the same as any other client.
For both security and cross-client compatibility, this change brings
eth_sign up to the same behavior as personal_sign, without deprecating
that method, again for retroactive compatibility.
Fixes #2215