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

setLockPeriods accepts multipliers less than 100 (1x mult) #137

Closed
code423n4 opened this issue Jan 6, 2022 · 3 comments
Closed

setLockPeriods accepts multipliers less than 100 (1x mult) #137

code423n4 opened this issue Jan 6, 2022 · 3 comments
Labels
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 duplicate This issue or pull request already exists invalid This doesn't seem right sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")

Comments

@code423n4
Copy link
Contributor

Handle

StErMi

Vulnerability details

Impact

In the setLockPeriods you are not making any checks on the multipliers value for a given index. It means that the multiplier could be less than 100 (1x).

Proof of Concept

Tools Used

Manual

Recommended Mitigation Steps

If you don't want to enable multiplier less than 100 add a check on setLockPeriods like

require(multipliers[i] >= 100, "INVALID_MULTIPLIER");

@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 Jan 6, 2022
code423n4 added a commit that referenced this issue Jan 6, 2022
@deluca-mike deluca-mike added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") labels Jan 8, 2022
@deluca-mike
Copy link
Collaborator

deluca-mike commented Jan 8, 2022

Supporting less that 100 (i.e. less than 1x) was intended behaviour (i.e. 30-day lockup gets you normal rewards, and, say 0-day lockups gets you 0.5x rewards). However, there is a good catch since the resulting units from the calculation in lock should be checked for 0 (instead of checking the amount_ argument for 0), since that's a better and more all-encompassing way to filter out amount that are too low (or zero) after taking the multiplier into account. This is low-risk though, because the amount would have to be miniscule (less than 100 wei of XDEFI) for 0 units to result.

@deluca-mike deluca-mike added duplicate This issue or pull request already exists and removed 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments labels Jan 9, 2022
@deluca-mike
Copy link
Collaborator

Duplicate #96

@Ivshti
Copy link
Member

Ivshti commented Jan 16, 2022

@deluca-mike tbh I am on the fence between this being an invalid finding and your assessment of it as low-risk

Under 1 multipliers are a very useful tool as you say, and really small multiplier leading to a 0 amount, leaving behind some dust also sounds ok

@Ivshti Ivshti added the invalid This doesn't seem right label Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 duplicate This issue or pull request already exists invalid This doesn't seem right sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Projects
None yet
Development

No branches or pull requests

4 participants