diff --git a/crypto/crypto.go b/crypto/crypto.go index aaa5cc43a2..f9979aa4bb 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -178,6 +178,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) { if x == nil { return nil, errInvalidPubkey } + if !S256().IsOnCurve(x, y) { + return nil, errInvalidPubkey + } return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil }