Potential DoS when removing keeper gauge #71
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
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/InflationManager.sol#L609-L618
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/tokenomics/KeeperGauge.sol#L82
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/actions/topup/TopUpActionFeeHandler.sol#L95-L98
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/actions/topup/TopUpAction.sol#L807
https://github.com/code-423n4/2022-05-backd/blob/2a5664d35cde5b036074edef3c1369b984d10010/protocol/contracts/actions/topup/TopUpAction.sol#L653
Vulnerability details
Impact
When
_removeKeeperGauge
is called, there is no guarantee that the keeper gauge isn't currently in use by anyTopUpActionFeeHandler
. If it's still in use, any top up action executions will be disabled as reporting fees inKeeperGauge.sol
will revert:If this happened during extreme market movements, some positions that require a top up will not be executed and be in risk of being liquidated.
Proof of Concept
InflationManager.removeKeeperGauge
, replacing an old keeper gauge. However, governance forgot to callTopUpActionFeeHandler.prepareKeeperGauge
soTopUpActionFeeHandler.getKeeperGauge
still points to the killed gauge.prepareKeeperGauge
with a 3 days delay.Recommended Mitigation Steps
Consider adding an on-chain check to ensure that the keeper gauge is not in use before removing them.
The text was updated successfully, but these errors were encountered: