Closed sherlock-admin2 closed 5 months ago
1 comment(s) were left on this issue during the judging contest.
0xmystery commented:
invalid because user input validation to prevent user mistakes is not considered a valid issue. Additionally, the likelihood of the scenario happening is extremely low
The protocol team fixed this issue in the following PRs/commits: https://github.com/sophon-org/farming-contracts/commit/f0b82fd83a5d85eb8dc7ba2bbce2d49fefb326a4
The Lead Senior Watson signed off on the fix.
0xboriskataa
medium
User can deposit into sDAI pool using ETH
Summary
User can deposit into sDAI pool using ETH
Vulnerability Detail
In
SophonFarming.sol
there is a functiondepositEth
in which a user can specify a predefined pool and deposit ETH into it:As you can see from the code snippet it checks if
_predefinedPool
is either wstETH or weETH and converts the user's ETH into the coresponding asset and deposits that asset. However there is one more asset that exists in thePredefinedPool
struct which issDAI
.If a user specifies sDAI as a
_predefinedPool
the function will not revert. The code will continue its executon into_depositPredefinedAsset
where it will convert some of the DAI the contract holds into sDAI and then update the pool's balance.Impact
Wrong conversions happen. An amount of DAI corresponding to the amount of ETH the user deposits gets converted into sDAI even though the user deposited ETH not DAI.
Code Snippet
https://github.com/sherlock-audit/2024-05-sophon/blob/main/farming-contracts/contracts/farm/SophonFarming.sol#L503-L516 https://github.com/sherlock-audit/2024-05-sophon/blob/main/farming-contracts/contracts/farm/SophonFarming.sol#L524-L539
Tool used
Manual Review
Recommendation
Add an else statement in which the function reverts: