Any user can start inflation for Minter.sol #162
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate
This issue or pull request already exists
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();
}
The text was updated successfully, but these errors were encountered: