HardhatFoundry
30,000 USDC
View results
Submission Details
Severity: medium
Invalid

Signature Malleability in `isValidSignatureWithSender` Function Allows Multiple Valid Signatures for the Same Message

## Summary
The [K1Validator::isValidSignatureWithSender](https://github.com/Cyfrin/2024-07-biconomy/blob/9590f25cd63f7ad2c54feb618036984774f3879d/contracts/modules/validators/K1Validator.sol#L99) function is vulnerable to signature malleability. This allows an attacker to create multiple valid signatures for the same message, potentially bypassing restrictions that rely on unique signatures.
## Vulnerability Details
The `isValidSignatureWithSender` function is affected by a signature malleability issue. The root cause of this vulnerability lies in the [SignatureCheckerLib](https://github.com/Vectorized/solady/blob/a34977e56cc1437b7ac07e6356261d2b303da686/src/utils/SignatureCheckerLib.sol#L23) used within the function, which does not check if a signature is non-malleable.
```javascript
function isValidSignatureWithSender(address, bytes32 hash, bytes calldata data) external view returns (bytes4) {
address owner = smartAccountOwners[msg.sender];
-> if (SignatureCheckerLib.isValidSignatureNowCalldata(owner, hash, data)) {
return ERC1271_MAGICVALUE;
}
-> if (SignatureCheckerLib.isValidSignatureNowCalldata(owner, MessageHashUtils.toEthSignedMessageHash(hash), data)) {
return ERC1271_MAGICVALUE;
}
return ERC1271_INVALID;
}
```
As a result, an attacker can create multiple valid signatures for the same message (digest). This allows the attacker to bypass restrictions that rely on the uniqueness of signatures, potentially leading to unauthorized actions or replay attacks.
## Impact
This vulnerability poses a significant security risk as it allows the creation of multiple valid signatures for the same message. Consequently, an attacker can bypass restrictions that rely on the uniqueness of signatures. This could potentially lead to unauthorized actions or replay attacks, undermining the integrity and security of the contract.
[Similar Finding](https://solodit.xyz/issues/m-9-signature-is-malleable-sherlock-titles-publishing-protocol-git).
## Tools Used
Manual review
## Recommendations
Implement EIP-712 for typed data signing, which includes nonce and domain separation to prevent replay attacks.
Ensure the signature scheme used checks for non-malleability.
Updates

Lead Judging Commences

0xnevi Lead Judge
12 months ago
0xnevi Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Appeal created

0xabhayy Submitter
12 months ago
0xnevi Lead Judge
12 months ago
0xnevi Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.