sherlock-audit / 2024-05-midas-judging

13 stars 6 forks source link

T_F_E - User can be redeemed more tokens than they deposited. #98

Closed sherlock-admin4 closed 6 months ago

sherlock-admin4 commented 6 months ago

T_F_E

high

User can be redeemed more tokens than they deposited.

Summary

Users can redeem more tokens than they deposited. Even users who never deposited can be redeemed rewards. GREENLISTED_ROLE , RESTRICTED

Vulnerability Detail

User A deposits $1,000 worth of USDC. The user's total deposited amount is increased, but when redeeming, there is no internal accounting to prevent the user from redeeming more than they deposited and thus a a malicious GREENLISTED_ROLE can transfer more tokens than user deposited when redeeming. Similarly, a malicious GREENLISTED_ROLE can transfer tokens to users who didn't deposit at all.

Impact

Loss of funds for the protocol.

Code Snippet

https://github.com/sherlock-audit/2024-05-midas/blob/main/midas-contracts/contracts/RedemptionVault.sol#L61

Tool used

Manual Review

Recommendation

Make user of internal accounting while redeeming