Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal EIP712 signature for signTypedData #151

Closed
chzyer opened this issue Jun 24, 2022 · 3 comments
Closed

Illegal EIP712 signature for signTypedData #151

chzyer opened this issue Jun 24, 2022 · 3 comments

Comments

@chzyer
Copy link

chzyer commented Jun 24, 2022

Hi, there.

We are receiving some illegal EIP712 signatures from the ledger wallet, the v is 0 or 1. As we know, v should be 27 or 28 as a valid EIP712 signature.

So I'm checking the source code as follows:

let v = payload.v - 27
v = v.toString(16)
if (v.length < 2) {
v = `0${v}`
}
const signature = `0x${payload.r}${payload.s}${v}`
const addressSignedWith = sigUtil.recoverTypedSignature_v4({
data,
sig: signature,
})
if (ethUtil.toChecksumAddress(addressSignedWith) !== ethUtil.toChecksumAddress(withAccount)) {
throw new Error('Ledger: The signature doesnt match the right address')
}
return signature

I guest it minus 27 because it wants to recover the signer, but it forgot to return the original signature. The signature should be return 0x${payload.r}${payload.s}${payload.v}, not return signature

According to this MetaMask/metamask-extension#10240 (comment), I found some projects also have this issue.

So I think maybe we can fix the root cause?

@xiaohanzhu
Copy link

Any plan to fix this bug?

@mcmire
Copy link

mcmire commented Jan 18, 2023

It appears that this bug was fixed in #152. We will issue a new release soon.

@mcmire mcmire closed this as completed Jan 18, 2023
@cryptoKevinL
Copy link

Is this fix in for Ledger Live or for the Ledger/Metamask Integration? We are having the issue as well

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

No branches or pull requests

4 participants