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

Any user can start inflation for Minter.sol #162

Closed
code423n4 opened this issue Jun 3, 2022 · 2 comments
Closed

Any user can start inflation for Minter.sol #162

code423n4 opened this issue Jun 3, 2022 · 2 comments
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L187-L215

Vulnerability details

Submitting as a high risk bug because it is equivalent to calling startInflation() which is a function reserved for only governance to call and it drastically alters token distribution

Impact

Bypass governance only call restriction and cause immediate inflation decay

Proof of Concept

The two main functions of startInflation() is to set lastEvent and lastInflationDecay to block.timestamp. startInflation() is restricted to allow governance to start inflation when it chooses. However these values can be set to block.timestamp by any user that calls executeInflationRateUpdate() because that function is not restricted to only governance. This allows any user to start inflation whenever they want. executeInflationRateUpdate() calls _executeInflationRateUpdate which sets lastEvent = block.timestamp in L189:

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L189

it also sets lastInflationDecay = block.timestamp in L212:

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L212

Additionally inflation decay will be immediately applied because L190 will return true because lastInflationDecay will still be at the default value of 0:

https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/Minter.sol#L190

Tools Used

Recommended Mitigation Steps

Add same lastEvent check as other functions in the contract

function executeInflationRateUpdate() external override returns (bool) {
if (lastEvent == 0) return 0;
return _executeInflationRateUpdate();
}

@code423n4 code423n4 added 3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working labels Jun 3, 2022
code423n4 added a commit that referenced this issue Jun 3, 2022
@danhper danhper added sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") duplicate This issue or pull request already exists and removed sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") labels Jun 6, 2022
@danhper danhper closed this as completed Jun 6, 2022
@chase-manning
Copy link
Collaborator

duplicate of #99

@GalloDaSballo
Copy link
Collaborator

Dup of #99

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 (High Risk) Assets can be stolen/lost/compromised directly bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

4 participants