Controller transfer extra token on withdrawing tokens #8
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Warden finding
duplicate
Another warden found this issue
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
Handle
jonah1005
Vulnerability details
Impact
The Controlle�r's
function withdraw(address _token, uint256 _amount)
should return whatever amount of the token user/vault asks. However, it tries to withdrawstrategy.want
token and convert it.Take for example, when a user/vault calls
withdraw(dai, 100)
, the controller should transfer100 dai
to the user/vault; instead, it withdraw100 t3crv
from the strategy, convert it to dai, and transfer the converted amount to the user. In this case, the user would get about 101 dai. (1 t3crv = 1.01 dai).1 percent of arbitrage space is enough to cause painful results. Also, the arbitrage space really depends on the strategy. Strategy should be able to have whatever want token, e.g., ETH, CRV,.... Vault users would definetly lose their money if the price not being handled properly.
I consider this a high-risk issue.
Proof of Concept
Controller.sol#L446-L477
We can trigger the bug with following web3.py script.
Since the first user gets more tokens than he should have, user2 would not be able to withdraw all the shares.
Tools Used
None
Recommended Mitigation Steps
The text was updated successfully, but these errors were encountered: