Platform: Code4rena
Start Date: 24/03/2022
Pot Size: $75,000 USDC
Total HM: 15
Participants: 59
Period: 7 days
Judge: gzeon
Id: 103
League: ETH
Rank: 2/59
Findings: 2
Award: $6,849.87
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: 0xDjango
Also found by: GeekyLumberjack, pmerkleplant
https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Facets/GenericSwapFacet.sol#L28-L30
Failed transfer with low level call won't revert
A missing require may cause user to lose funds if a corner case issue filed separately named Failed transfer with low level call won't revert
. This may result in user funds lost because funds were transferred into this contract in preparation for the swap. The swap fails but doesn't revert. In GenericSwapFacet.sol there is no require to check that postSwapBalance
is greater than 0. However, there is in the other facets.
_swapData.callTo.call{ value: msg.value }(_swapData.callData);
fails but returns success due to nonexisting contractManual review
add require(postSwapBalance > 0, "ERR_INVALID_AMOUNT");
#0 - H3xept
2022-04-06T15:14:16Z
Fixed in lifinance/lifi-contracts@91870a578e8dd315b057acc5eb3370ffa0186208
#1 - H3xept
2022-04-11T11:46:39Z
Duplicate of #76
🌟 Selected for report: GeekyLumberjack
Also found by: CertoraInc
https://github.com/code-423n4/2022-03-lifinance/blob/main/src/Libraries/LibSwap.sol#L42-L46
swap
is used throughout the code via _executeSwaps
in Swapper.sol. According to Solidity Docs the call may return true even if it was a failure. This may result in user funds lost because funds were transferred into this contract in preparation for the swap. The swap fails but doesn't revert. There is a way this can happen through GenericSwapFacet.sol due to a missing require that is present in the other facets which is a separate issue but gives this issue more relevance.
_swapData.callTo.call{ value: msg.value }(_swapData.callData);
fails but returns success due to nonexisting contractManual review
Check for contract existence
A similar issue was awarded a medium here
#0 - gzeoneth
2022-04-16T17:43:52Z
Sponsor confirmed with fix.