https://github.com/Cyfrin/2024-11-one-world/blob/1e872c7ab393c380010a507398d4b4caca1ae32b/contracts/meta-transaction/NativeMetaTransaction.sol#L90
The verify
function in the NativeMetaTransaction
contract lacks proper validation of the ECDSA signature recovery parameter (v). This omission could lead to signature malleability issues and potential replay attacks, as the function accepts any value for the recovery parameter without enforcing the standard Ethereum signature requirements.
In the current implementation, the verify function passes the signature parameters directly to ecrecover without validating the v parameter:
The vulnerability stems from incomplete signature validation in the verify function. While the function checks for a non-zero address signer, it overlooks the crucial validation of the v parameter. According to Ethereum's ECDSA
implementation, valid v
values must be either 27 or 28 for standard signatures, or follow the EIP-155
format of chainId * 2 + 35 or chainId * 2 + 36 when chain ID protection is implemented. The current implementation bypasses these checks, allowing potentially malformed signatures to be processed.
The lack of signature validation creates serious security implications for the meta-transaction system. Without proper v parameter validation, attackers could potentially manipulate signatures while keeping them functionally valid, enabling signature malleability attacks. This vulnerability also wastes gas by allowing ecrecover calls with invalid parameters, and most critically, reduces the overall security guarantees of the signature verification system. In a meta-transaction context, where signatures authorize actions on behalf of users, such weaknesses in signature validation could lead to unauthorized transactions or replay attacks.
Manual Review
The solution requires implementing proper validation of the signature recovery parameter before processing the signature. The following code is an idea of how it should be:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.