Summary
The StabilityPool contract exhibits significant centralization risks through numerous privileged owner functions that control critical protocol parameters and operations without sufficient checks and balances.
Vulnerable Code Locations
function addManager(address manager, uint256 allocation) external onlyOwner
function removeManager(address manager) external onlyOwner
function updateAllocation(address manager, uint256 newAllocation) external onlyOwner
function setRAACMinter(address _raacMinter) external onlyOwner
function setLiquidityPool(address _liquidityPool) external onlyOwner
function addMarket(address market, uint256 allocation) external onlyOwner
function removeMarket(address market) external onlyOwner
function updateMarketAllocation(address market, uint256 newAllocation) external onlyOwner
function pause() external onlyOwner
function unpause() external onlyOwner
Impact
-
Protocol Manipulation
Owner can arbitrarily add/remove managers who control liquidations
Can pause all user operations without delay
Can redirect protocol flows by changing critical addresses
-
Economic Risks
Control over market allocations affects reward distribution
Manager allocation changes can impact liquidation processes
No timelock on parameter changes allows instant modifications
-
Trust Requirements
Users must fully trust owner not to abuse powers
No governance oversight on parameter changes
Single account holds emergency powers
Proof of Concept
function manipulateProtocol() external {
stabilityPool.addManager(attacker, type(uint256).max);
stabilityPool.pause();
stabilityPool.liquidateBorrower(victimAddress);
}
Recommended Mitigation
Implement Timelocks
contract StabilityPool is IStabilityPool, TimelockController {
uint256 public constant TIMELOCK_DELAY = 2 days;
function setLiquidityPool(address _liquidityPool) external {
require(isOperationPending(keccak256("setLiquidityPool")), "Timelock not initiated");
}
}
Add Multi-signature Requirements
modifier onlyMultisig() {
require(multisig.isConfirmed(msg.sig, msg.sender), "Requires multi-sig");
_;
}
Implement Governance Controls
Add DAO voting for parameter changes
Require community approval for critical changes
Set maximum limits on parameter values
Enhanced Event Logging
event ProtocolParameterChanged(
string indexed parameterName,
address indexed actor,
uint256 oldValue,
uint256 newValue,
uint256 timestamp
);