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

Fallback handlers have no authorization control

Description

The protocol implements fallback handlers, when installed they can be triggered by anyone by using the fallback function:

fallback() external payable override(Receiver) receiverFallback {
FallbackHandler storage $fallbackHandler = _getAccountStorage().fallbacks[msg.sig];
address handler = $fallbackHandler.handler;
CallType calltype = $fallbackHandler.calltype;
require(handler != address(0), MissingFallbackHandler(msg.sig));
if (calltype == CALLTYPE_STATIC) {
assembly {
calldatacopy(0, 0, calldatasize())
// The msg.sender address is shifted to the left by 12 bytes to remove the padding
// Then the address without padding is stored right after the calldata
mstore(calldatasize(), shl(96, caller()))
if iszero(staticcall(gas(), handler, 0, add(calldatasize(), 20), 0, 0)) {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
returndatacopy(0, 0, returndatasize())
return(0, returndatasize())
}
}
if (calltype == CALLTYPE_SINGLE) {
assembly {
calldatacopy(0, 0, calldatasize())
// The msg.sender address is shifted to the left by 12 bytes to remove the padding
// Then the address without padding is stored right after the calldata
mstore(calldatasize(), shl(96, caller()))
if iszero(call(gas(), handler, 0, 0, add(calldatasize(), 20), 0, 0)) {
returndatacopy(0, 0, returndatasize())
revert(0, returndatasize())
}
returndatacopy(0, 0, returndatasize())
return(0, returndatasize())
}
}
}

as we go through the fallback flow we see that no authorization control has been implemented

This is also confirmed per the sponsor on discord:

// once installed, anyone can trigger a fallback on the SA. so it should be carefully designed

The protocol states to be fully compliant with ERC 7579:

// Nexus is a suite of contracts for Modular Smart Accounts compliant with ERC-7579 and ERC-4337,

But as per the EIP 7579:

/* Fallback Handlers
If the smart account has a fallback handler installed, it:
- MUST implement authorization control

This means that if fallback handlers are installed, they must include authorization control. However, in this case, the protocol does not implement any authorization control.

Ultimately, a core functionality from ERC-7579 is broken.

Recommendation

implement authorization control to be EIP-7579 compliant.

Updates

Lead Judging Commences

0xnevi Lead Judge 11 months ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-fallback-missing-access-control-module-manager

There is indeed no access control within `fallback()` function which violates ERC7579 spec but the impact shown by all issues is insufficient. Need a better impact description/PoC that exceeds violation of ERC7579 to raise the severity of this issue. There will likely be no exploit for staticcall types, given there is not [state change/funds transfer allowed](https://www.rareskills.io/post/solidity-staticcall), so the possible vulnerability would be in the `CALLTYPE_SINGLE`. If no sufficient proof is provided to show a possible exploit, I will likely invalidate these issues.

Support

FAQs

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