Submitted by AkshaySrivastav, also found by KupiaSec
The Guard::checkTransaction functions current design unintentionally restricts native ETH transfers from the safe. This limitation originates from a data length check that requires transaction data to be at least 4 bytes long, aiming to validate the presence of a function selector.
However, since native ETH transfers have empty data fields, they fail this, leading to an inability to execute such transfers.
This results in a significant functional restriction, as users are unable to execute standard ETH transfers from their safes.
The Safe contracts contains receive function which by default enables them to receive native ETH. These native tokens can be transferred to safe by protocol users or current/future protocol hooks.
The Guard::checkTransaction is designed to validate transactions initiated by a rental safe. Its role is to ascertain whether a transaction meets the set criteria based on its destination, value, data and operation type. This function is a critical component in ensuring that transactions are executed in accordance with the protocols rule.
A notable issue within the Guard::checkTransaction function is its requirement for transaction data to be at least 4 bytes long, as indicated by this code:
In src/policies/Guard.sol
https://github.com/re-nft/smart-contracts/blob/3ddd32455a849c3c6dc3c3aad7a33a6c9b44c291/src/policies/Guard.sol#L328C1-L331C10
This condition is ideal for transactions involving function calls where a function selector is necessary.
However, this becomes problematic for native ETH transfers, which are characteristically simple transactions without any data payload. As these transactions have a data length of zero bytes, failing the imposed condition.
Such transactions are automatically rejected by the Guard::checkTransaction function due to not meeting the 4-byte data length requirement.
The inability to transfer native ETH not only reduces the safes practicality but also poses a severe limitation on user operations, affecting trust and reliability in the system.
The following foundry test shows the process described above. Copy and paste it into test folder to run.
Foundry
Consider allowing data.length to be 0 as that will be used for performing native ETH transfers.
0xean (Judge) commented:
Alec1017 (reNFT) confirmed and commented:
reNFT mitigated:
Status: Mitigation confirmed. Full details in reports from EV_om and sin1st3r__.
