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

Missing minReturn check for user deposits #58

Closed
code423n4 opened this issue Mar 19, 2022 · 2 comments
Closed

Missing minReturn check for user deposits #58

code423n4 opened this issue Mar 19, 2022 · 2 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-03-prepo/blob/f63584133a0329781609e3f14c3004c1ca293e71/contracts/core/Collateral.sol#L210

Vulnerability details

Impact

The owners of the contract can set a minting fee.
A user might want to deposit at the current minting fee, while their transaction is pending, a new setMintingFee transaction is mined.
The user receives fewer shares than they expected and essentially loses funds due to the higher fees.

Recommended Mitigation Steps

Accept a minShares parameter in deposit and check if _shares >= minShares.

@code423n4 code423n4 added 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value bug Something isn't working labels Mar 19, 2022
code423n4 added a commit that referenced this issue Mar 19, 2022
@ramenforbreakfast
Copy link
Collaborator

I think this issue is a minor edge case and supplying a slippage parameter for minting vault shares adds unnecessary complexity.

@ramenforbreakfast ramenforbreakfast added the sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue label Mar 23, 2022
@gzeoneth
Copy link
Member

gzeoneth commented Apr 3, 2022

Agree with sponsor, downgrading to Low/QA. Adding a slippage check will also increase the chance of revert if the vault earned profit (which will increase share price and decrease share per deposit). Closing in favor of warden's QA report #59

@gzeoneth gzeoneth closed this as completed Apr 3, 2022
@gzeoneth gzeoneth added QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax duplicate This issue or pull request already exists and removed 2 (Med Risk) Assets not at direct risk, but function/availability of the protocol could be impacted or leak value labels Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists QA (Quality Assurance) Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax sponsor disputed Sponsor cannot duplicate the issue, or otherwise disagrees this is an issue
Projects
None yet
Development

No branches or pull requests

3 participants