Submitted by adriro, also found by parsely, adriro, VAD37 and fyvgsk.
The FeeWrapper contract can be used to wrap calls that include ETH payments. This is handled by the _rubicallPayable function:
https://github.com/code-423n4/2023-04-rubicon/blob/main/contracts/utilities/FeeWrapper.sol#L76-L89
As we can see in the previous snippet, the implementation will forward the ETH payment (minus fees) to the target contract. If the target contract ends up using less ETH than the sent amount, then the usual approach would be to refund the remaining ETH back to the caller, which is a normal and common operation.
If this is the case, then the wrapped call will fail as the FeeWrapper doesnt implement the receive or fallback function to allow ETH payments. Even though there is no loss of funds as the transaction is reverted, the issue will prevent users from wrapping calls to target contracts that may refund ETH as part of their normal behavior.
As a potential real example, we can the explore the buyAllAmountWithETH function present in the RubiconRouter contract:
https://github.com/RubiconDeFi/rubi-protocol-v2/blob/master/contracts/utilities/RubiconRouter.sol#L379-L418
As we can see in the previous snippet, the function will potentially refund the caller the unspent ETH in lines 412-417. If this call is being wrapped using the FeeWrapper, then msg.sender will be the FeeWrapper contract.
In the following test, we create a demonstration contract FeeWrapperTarget which includes a function named demoETH that will refund half of the sent amount back to the caller. The wrapped call will fail, as the FeeWrapperTarget will try to refund the ETH to the FeeWrapper contract which doesnt allow ETH payments, causing the whole transaction to be reverted.
Note: the snippet shows only the relevant code for the test. Full test file can be found here.
Allow the FeeWrapper contract to receive ETH by implementing the receive function. After the call to the target contract, refund any ETH amount present in the FeeWrapper contract back to the original caller.
daoio (Rubicon) confirmed via duplicate issue #1283
HickupHH3 (judge) increased severity to High and commented:
