There are multiple ways for admins/governance to rug users
The report describes several ways a malicious admin or governance could steal user funds or lock balances, such as by setting a migration pool that forwards funds to an attacker-controlled address, adding unlimited reward tokens to cause out-of-gas errors on withdrawal, or setting a malicious fee burner. An attacker with admin privileges could therefore rug users.
Submitted by IllIllI, also found by 0x1f8b
Impact
A malicious admin can steal user funds or lock their balances forever.
Even if the user is benevolent the fact that there is a rug vector available may negatively impact the protocol’s reputation.
Proof of Concept
Unlike the original Convex code that goes to great lengths to prevent users having the ability to transfer funds/mint things, this project introduces multiple roles and new abilities that require users to place more trust in governance:
- Admins can initiate migrations and set the
newPool_to be a contract that forwards funds to accounts they control
File: protocol/contracts/zaps/PoolMigrationZap.sol #1
61 ILiquidityPool newPool_ = _underlyingNewPools[underlying_];
62 uint256 ethValue_ = underlying_ == address(0) ? underlyingAmount_ : 0;
63 newPool_.depositFor{value: ethValue_}(msg.sender, underlyingAmount_);
- Admins can add infinite
newRewardTokens:
File: protocol/contracts/BkdLocker.sol #2
70 function migrate(address newRewardToken) external override onlyGovernance {
71 _replacedRewardTokens.remove(newRewardToken);
72 _replacedRewardTokens.set(rewardToken, block.timestamp);
73 lastMigrationEvent = block.timestamp;
74 rewardToken = newRewardToken;
75 }
so that _userCheckpoint()s, which are required to withdraw funds, revert because they run out of gas iterating over the tokens:
File: protocol/contracts/BkdLocker.sol #3
292 function _userCheckpoint(
293 address user,
294 uint256 amountAdded,
295 uint256 newTotal
296 ) internal {
297 RewardTokenData storage curRewardTokenData = rewardTokenData[rewardToken];
298
299 // Compute the share earned by the user since they last updated
300 uint256 userBalance = balances[user];
301 if (userBalance > 0) {
302 curRewardTokenData.userShares[user] += (curRewardTokenData.feeIntegral -
303 curRewardTokenData.userFeeIntegrals[user]).scaledMul(
304 userBalance.scaledMul(boostFactors[user])
305 );
306
307 // Update values for previous rewardTokens
308 if (lastUpdated[user] < lastMigrationEvent) {
309 uint256 length = _replacedRewardTokens.length();
310 for (uint256 i; i < length; i = i.uncheckedInc()) {
- Admins can set a malicious
feeBurner, via the addressProvider, which just takes the fees for itself
File: protocol/contracts/RewardHandler.sol #4
35 function burnFees() external override {
36 IBkdLocker bkdLocker = IBkdLocker(addressProvider.getBKDLocker());
37 IFeeBurner feeBurner = addressProvider.getFeeBurner();
38 address targetLpToken = bkdLocker.rewardToken();
39 address[] memory pools = addressProvider.allPools();
40 uint256 ethBalance = address(this).balance;
41 address[] memory tokens = new address[](pools.length);
42 for (uint256 i; i < pools.length; i = i.uncheckedInc()) {
43 ILiquidityPool pool = ILiquidityPool(pools[i]);
44 address underlying = pool.getUnderlying();
45 if (underlying != address(0)) {
46 _approve(underlying, address(feeBurner));
47 }
48 tokens[i] = underlying;
49 }
50 feeBurner.burnToTarget{value: ethBalance}(tokens, targetLpToken);
- Admins can set an oracle that provides the wrong answers:
File: protocol/contracts/swappers/SwapperRouter.sol #5
452 try _addressProvider.getOracleProvider().getPriceETH(token_) returns (uint256 price_) {
Recommended Mitigation Steps
The trust-minimizing approach that Convex took was to not allow admins to change addresses. In order for things to change, an admin is allowed to completely shut everything down, and during the shut down state, users are still able to withdraw their funds. Later, the admins spin up a whole new set of contracts, and let users migrate things themselves. Something similar can be done here by having the DAO accept proposals to spawn specific contracts, and hook up specific addresses in certain ways in the new deployment.
danhper (Backd) disputed and commented:
This is a design decision. Many protocols are fully upgradeable (Compound, Aave, Maker) and some decide to be fully immutable (Convex, Curve). The governance process will be formalized a little later and have safeguards in place but we are not planning on following Convex’s approach nor think that it is the “correct” way to design a protocol.
Alex the Entreprenerd (judge) commented:
The warden has listed multiple ways in which Admin Privilege can be used against users of the protocol.
While the sponsor may be fully aware of these mechanics, it is very important that these type of risks are clearly explained to end-users as they can ultimately bear the consequences of those risks.
Because the findings are contingent on a malicious admin, I believe Medium Severity to be appropriate.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the design gives admins the ability to change critical addresses and parameters without sufficient safeguards, unlike the original Convex code which prevents such changes.
What the attacker needed
Malicious admin or compromised governance
The fix
The trust-minimizing approach is to not allow admins to change addresses; instead, admins can shut down the system, users withdraw, and then a new deployment is set up for users to migrate themselves.
How it was found
- Admins initiate a migration and set the new pool to a contract they control.
- Admins add many new reward tokens via the migrate function.
- Admins set a malicious fee burner through the address provider.
- Admins set an oracle that returns incorrect prices.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
In this smart contract system, the people who control the admin keys have a lot of power. The report shows that they could change settings to send user money to themselves or make it impossible for users to withdraw. This means users have to trust the admins not to steal from them.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.