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

`Nexus.sol` Signature Validation Issue

Summary

The signature validation process in Nexus.sol can fail under specific conditions, particularly for counterfactual ERC-4337 accounts, which impacts the usability for users of certain wallets.

Vulnerability Details

The function isValidSignatureWithSender uses SignatureCheckerLib to validate signatures. It assumes the contract implementing ERC-1271 is already deployed, which is problematic for ERC-4337 accounts that exist "counterfactually" (i.e., they have addresses but are not yet deployed).

https://github.com/Cyfrin/2024-07-biconomy/blob/9590f25cd63f7ad2c54feb618036984774f3879d/contracts/modules/validators/K1Validator.sol#L95-L108

function isValidSignatureWithSender(address, bytes32 hash, bytes calldata data) external view returns (bytes4) {
address owner = smartAccountOwners[msg.sender];
// Validate the signature using SignatureCheckerLib
if (SignatureCheckerLib.isValidSignatureNowCalldata(owner, hash, data)) {
return ERC1271_MAGICVALUE;
}
if (SignatureCheckerLib.isValidSignatureNowCalldata(owner, MessageHashUtils.toEthSignedMessageHash(hash), data)) {
return ERC1271_MAGICVALUE;
}
return ERC1271_INVALID;
}

Issue Explanation

  • Counterfactual Account Issue: The function validates signatures for smartAccountOwners[msg.sender], assuming these contracts are deployed. For ERC-4337 accounts, which are counterfactual, the contracts are not deployed yet, causing signature validation to fail.

  • No Handling for Counterfactual States: The function lacks a mechanism to handle the scenario where the contract is not deployed. It only checks for deployed contracts using the signature directly or the Ethereum-signed message hash.

Impact

This vulnerability impacts Biconomy's ability to validate signatures for counterfactual ERC-4337 accounts, limiting the functionality for users relying on account abstraction (AA) wallets. Consequently, operations in Nexus.sol that require signature validation are unavailable to some users, affecting the overall usability of the platform.

Tools Used

Manual review

Recommendations

To address this issue, it is recommended to implement EIP-6492. This EIP provides a universal method to verify signatures from both deployed and counterfactual contracts.

Updates

Lead Judging Commences

0xnevi Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

finding-signature-validation-process-broken

Invalid, there is no information indicating biconomy inteads to support counterfactual ERC4337 wallets. So I see the intended use case of this counterfactual wallets as more of a feature request/improvement than a vulnerability.

Support

FAQs

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