You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
The claimMessageMatchesSignature function in the ClaimContract uses the Solidity ecrecover function directly to verify signatures. This implementation is vulnerable to signature malleability, which could potentially lead to replay attacks or other security issues.
Impact:
Signature Malleability: The ecrecover EVM opcode allows for malleable (non-unique) signatures. For every valid signature (r,s,v), there exists another valid signature (r,-s mod N,v') for the same message and signer.
Potential for Replay Attacks: While the current implementation may not be directly vulnerable to replay attacks due to other safeguards (like balance checks), the use of malleable signatures is considered a security risk and could become problematic if the contract is modified or integrated with other systems.
Inconsistent Signature Verification: Malicious actors could potentially create multiple valid signatures for the same message, which could lead to unexpected behavior or confusion in logging and auditing processes.
The vulnerability is present in the following part of the claimMessageMatchesSignature function: return ecrecover(messageHash, _v, _r, _s) == pubKeyEthAddr;
This direct use of ecrecover does not protect against signature malleability.
Proof of Concept:
A valid signature (r, s, v) is created for a claim.
An attacker could create a new signature (r, -s mod N, v') which would also be valid for
the same claim.
Both signatures would pass the verification in claimMessageMatchesSignature.
Recommended Mitigation Steps:
Use OpenZeppelin's ECDSA library for signature verification:
Consider implementing a nonce system for each claim to prevent any possibility of replay attacks:
mapping(bytes20 => uint256) public nonces;
function claimMessageMatchesSignature(
// ... existing parameters ...
uint256 nonce
) public view returns (bool) {
require(nonce == nonces[oldAddress], "Invalid nonce");
// ... rest of the function ...
}
The text was updated successfully, but these errors were encountered:
softstackio
changed the title
[M-01] Signature Malleability in Ecrecover
[M-01] Potential Signature Malleability and Replay Attack Vulnerability in Claim Verification
Sep 10, 2024
Description:
The
claimMessageMatchesSignature
function in the ClaimContract uses the Solidityecrecover
function directly to verify signatures. This implementation is vulnerable to signature malleability, which could potentially lead to replay attacks or other security issues.Impact:
The vulnerability is present in the following part of the
claimMessageMatchesSignature
function:return ecrecover(messageHash, _v, _r, _s) == pubKeyEthAddr;
This direct use of ecrecover does not protect against signature malleability.
Proof of Concept:
the same claim.
Recommended Mitigation Steps:
The text was updated successfully, but these errors were encountered: