File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 99 BIGINT_1 ,
1010 KECCAK256_NULL ,
1111 MAX_UINT64 ,
12+ SECP256K1_ORDER_DIV_2 ,
1213 bytesToBigInt ,
1314 bytesToHex ,
1415 bytesToUnprefixedHex ,
@@ -453,9 +454,15 @@ async function _runTx(vm: VM, opts: RunTxOpts): Promise<RunTxResult> {
453454 // EIPs PR: https://github.com/ethereum/EIPs/pull/8938
454455 continue
455456 }
457+ const s = data [ 5 ]
458+ if ( bytesToBigInt ( s ) > SECP256K1_ORDER_DIV_2 ) {
459+ // Malleability protection to avoid "flipping" a valid signature to get
460+ // another valid signature (which yields the same account on `ecrecover`)
461+ // This is invalid, so skip this auth tuple
462+ continue
463+ }
456464 const yParity = bytesToBigInt ( data [ 3 ] )
457465 const r = data [ 4 ]
458- const s = data [ 5 ]
459466
460467 const rlpdSignedMessage = RLP . encode ( [ chainId , address , nonce ] )
461468 const toSign = keccak256 ( concatBytes ( MAGIC , rlpdSignedMessage ) )
You can’t perform that action at this time.
0 commit comments