Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More accurate calculation of return USD of withdrawSingleByLiquidity #121

Open
code423n4 opened this issue Jul 10, 2021 · 0 comments
Open
Labels

Comments

@code423n4
Copy link
Contributor

Handle

shw

Vulnerability details

Impact

The withdrawSingleByLiquidity function of LifeGuard3Pool calls buoy.singleStableToUsd to calculate the return USD amount, which internally calls _stableToUsd with the deposit parameter set to true. A more accurate calculation is to set the deposit parameter to false since this action is a withdrawal. A similar issue exists in the function calcProtocolWithdraw of Allocation, where the current strategy's USD is calculated by buoy.singleStableToUsd.

Proof of Concept

Referenced code:
LifeGuard3Pool.sol#L226
Buoy3Pool.sol#L122
Allocation.sol#L142

Recommended Mitigation Steps

Consider adding a new boolean parameter, deposit, to the singleStableToUsd function of Buoy3Pool to indicate whether the action is a deposit or not, as that in the stableToUsd and stableToLp functions.

@code423n4 code423n4 added 1 (Low Risk) bug Something isn't working labels Jul 10, 2021
code423n4 added a commit that referenced this issue Jul 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants