Proper Champagne Raven
High
In the _countValidSignatures
function, a malicious signer can send the same signature multiple times in the signatures
parameter.
In HatsSignerGate.sol:656-683
, there is a missing check that the signature has already been used.
The function is inspired of the one from the safe wallet to validate transactions but safe function has this check:
if (currentOwner <= lastOwner || owners[currentOwner] == address(0) || currentOwner == SENTINEL_OWNERS)
revertWithError("GS026");
No response
- The malicious signer should be a valid owner. The issue is that only one valid signature is enough to pass the threshold.
- A valid signer send signatures with the same signature multiple times as
signatures
parameters. - The
checkTransaction
calls the internal_countValidSignatures
function. - The function does not revert, count the same signature multiple times as valid and a malicious transaction is validated.
A malicious signer can bypass the threshold security.
No response
Create a mapping variable checking if the signer has already sign the message during the call.
mapping(bytes32 => bool) hasSigned;
And in the loop something like this:
if (isValidSigner(currentOwner) && !hasSigned[keccak256(abi.encode(currentOwner, dataHash))]) {
// shouldn't overflow given reasonable sigCount
unchecked {
++validSigCount;
}
hasSigned[keccak256(abi.encode(currentOwner, dataHash))] = true;
}