Submitted by anon, also found by Audittens
Reverts in default account fallback function (when custom accounts delegate calls to a default account) may introduce security risks as protocols might not anticipate these reverts, resulting in vulnerabilities.
As stated in the documentation regarding the DefaultAccount:
https://github.com/code-423n4/2023-10-zksync/blob/main/docs/Smart%20contract%20Section/System%20contracts%20bootloader%20description.md#defaultaccount
To achieve this EOA-like behavior, the fallback and receive functions of the DefaultAccount contract are designed in such a way that, when called or delegate-called, they mimic the actions of an EOA:
https://github.com/code-423n4/2023-10-zksync/blob/1fb4649b612fac7b4ee613df6f6b7d921ddd6b0d/code/system-contracts/contracts/DefaultAccount.sol#L222-L231
However, theres an exception to this EOA-like behavior when a custom account delegate-calls a default account. Suppose the custom account execution function is implemented as follows:
In this scenario, if the to address is a default account, the fallback function of the default account will be invoked. Since the msg.sender is the bootloader address, it will trigger a revert due to assert(msg.sender != BOOTLOADER_FORMAL_ADDRESS) and success will be false. This is not the expected behavior, as to should act like an EOA and success should be true.
https://github.com/code-423n4/2023-10-zksync/blob/1fb4649b612fac7b4ee613df6f6b7d921ddd6b0d/code/system-contracts/contracts/DefaultAccount.sol#L224
This situation can potentially pose a significant issue for several reasons:
One potential solution is to add modifier ignoreInDelegateCall to the fallback function as well:
Context
miladpiri (zkSync) confirmed and commented:
Alex the Entreprenerd (judge) commented:
