sherlock-audit / 2024-01-napier-judging

9 stars 6 forks source link

0xepley - Mistakenly sent ETH will be Stuck #19

Closed sherlock-admin closed 7 months ago

sherlock-admin commented 7 months ago

0xepley

medium

Mistakenly sent ETH will be Stuck

Summary

user can loose mistakenly sent ETH

Vulnerability Detail

According to Slither analyzer detector documentation (https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether)

Possible functions that receive funds with the payable attribute must have a withdraw function to secure that funds can be sent out from the function or remove payable attribute.

The SFrxETHAdapter.sol contract allows the reception of Ether through the standard receive() external payable function, which is designed to accept Ether transactions. However, the lack of a corresponding withdrawal function within the contract means that any received Ether cannot be redistributed or reclaimed, essentially becoming stuck within the contract's balance.

So, any if a user mistakenly send eth to the contract then it will be stuck and he won't be able to withdraw it

receive() external payable {
}

Given the contract's current implementation, there is no method available for the owners, users, or any other party to retrieve the locked funds.

Impact

The SFrxETHAdapter.sol contract have a receive() function without any withdrawal mechanism. This can leads to a scenario where any Ether (ETH) sent to the contract address becomes permanently locked within the contract, as there is no method to transfer or withdraw these funds.

Code Snippet

https://github.com/sherlock-audit/2024-01-napier/blob/main/napier-v1/src/adapters/frax/SFrxETHAdapter.sol#L46

Tool used

Manual Review

Recommendation

To resolve this issue, the following steps are recommended:

In my opinion best way is the allow admin to withdraw the funds

References

https://solodit.xyz/issues/m-06-possible-locked-ether-funds-issue-in-rcorderbooksol-code4rena-reality-cards-reality-cards-contest-git

https://github.com/crytic/slither/wiki/Detector-Documentation#contracts-that-lock-ether

sherlock-admin commented 7 months ago

1 comment(s) were left on this issue during the judging contest.

tsvetanovv commented:

Invalid. Mistakenly sent ETH is invalid according to Sherlock docs