Challengers and bidders can collude together to restrict the minting of position owner
A challenger and bidder can collude to repeatedly trigger challenges that, when averted, call restrictMinting and suspend the position owner's minting for an additional day. This allows them to indefinitely block the owner from minting new tokens.
Submitted by peanuts, also found by Kumpa, m9800, deliriusz, 141345, ltyu, KIntern_NA, T1MOH, GreedyGoblin, rvierdiiev, LegendFenGuin, J4de, and deadrxsezzz
There is no restrictions as to how many challenges can occur at one given auction time. A challenger can potentially create an insanely large amount of challenges with a tiny amount of collateral for each challenge.
function launchChallenge(address _positionAddr, uint256 _collateralAmount) external validPos(_positionAddr) returns (uint256) {
IPosition position = IPosition(_positionAddr);
IERC20(position.collateral()).transferFrom(msg.sender, address(this), _collateralAmount);
uint256 pos = challenges.length;
challenges.push(Challenge(msg.sender, position, _collateralAmount, block.timestamp + position.challengePeriod(), address(0x0), 0));
position.notifyChallengeStarted(_collateralAmount);
emit ChallengeStarted(msg.sender, address(position), _collateralAmount, pos);
return pos;
}
Let’s say if the fair price of 1000 ZCHF is 1 WETH, and the position owner sets his position at the fair price. Rationally, there will be no challenges and bidders because the price is fair. However, the challenger can attack the position owner this way:
- Set a small amount of collateralAmount to challenge, ie 0.0001 WETH.
- The bidder comes and bid a price over 1000* ZCHF (Not the actual amount*. The actual amount is an equivalent amount scaled to the collateral, but for simplicity sake let’s just say 1000 ZCHF, ideally its like 1000 * 0.0001 worth)
- Because the bid is higher than 1000* ZCHF, tryAvertChallenge() succeeds and the bidder buys the collateral from the challenger.
- When tryAvertChallenge() succeeds, restrictMinting(1 days) is called to suspend the owner from minting for 1 additional day
- If the challenger and the bidder is colluding or even the same person, then the bidder does not lose out because he is essentially buying the collateral for a higher price from himself.
- The challenger and bidder can repeat this attack and suspend the owner from minting. Such attack is possible because there is nothing much to lose other than a small amount of gas fees
function tryAvertChallenge(uint256 _collateralAmount, uint256 _bidAmountZCHF) external onlyHub returns (bool) {
if (block.timestamp >= expiration){
return false; // position expired, let every challenge succeed
} else if (_bidAmountZCHF * ONE_DEC18 >= price * _collateralAmount){
// challenge averted, bid is high enough
challengedAmount -= _collateralAmount;
// Don't allow minter to close the position immediately so challenge can be repeated before
// the owner has a chance to mint more on an undercollateralized position
//@audit-- calls restrictMinting if passed
restrictMinting(1 days);
return true;
} else {
return false;
}
}
function restrictMinting(uint256 period) internal {
uint256 horizon = block.timestamp + period;
if (horizon > cooldown){
cooldown = horizon;
}
}
Impact
Minting for Position owner will be suspended for a long time.
Recommended Mitigation Steps
In this Frankencoin protocol, the challenger never really loses.
If the bid ends lower than the liquidation price, then the bidder wins because he bought the collateral at a lower market value. The challenger also wins because he gets his reward. The protocol owner loses because he sold his collateral at a lower market value.
If the bid ends higher than the liquidation price, then the bidder loses because he bought the collateral at a higher market value. The challenger wins because he gets to trade his collateral for a higher market value. The protocol owner neither wins nor loses.
The particular POC above is one way a challenger can abuse his power to create many challenges without any sort of consequence in order to attack the owner. In the spirit of fairness, the challenger should also lose if he challenges wrongly.
Every time a challenger issues a challenge, he should pay a small fix sum of money that will go to the owner if the bidder sets an amount higher than fair market value. (because that means that the protocol owner was right about the fair market value all along.)
Although the position owner can be a bidder himself, if the position owner bids on his own position in order to win this small amount of money, the position owner will lose at the same time because he is buying the collateral at a higher-than-market price from the challenger, so this simultaneous gain and loss will balance out.
#385highlights that even without the added cooldown - there’s no price exacted from the challenger in case they fail. This can lead to false challenges that DoS legitimate positions, hoping to win some of the challenges by chance.
luziusmeisser (Frankencoin) confirmed and commented:
Note that challenges must have a minimum size, so launching a large number of challenges locks up a significant amount of funds.
However, it is true that a challenger and a bidder that collude could trigger a cooldown period.
This is a valid issue. My mitigation is to not allow a challenge to be launched and averted in the same block. This ensures that the challenger has some money at risk as the challenger cannot be sure that it will be the bidder he is colluding with that can buy the collateral at a discount.
Example:
- Alice has a position with WETH as collateral at liquidation price 500 ZCHF and a minimum collateral amount of 10 WETH.
- Bob launches a challenge with 10 WETH.
- Bob wants to bid on his own challenge in the next block, but gets frontrun by Charles, who buys the 10 WETH from Bob at a price of only 5000 ZCHF. Assuming 1 WETH is worth 2000 ZCHF, Bob suffers from a loss of 15000 ZCHF.
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 lack of a cost or penalty for launching a challenge that is averted, combined with the restrictMinting call on a successful avert, allows repeated challenges to extend the minting cooldown.
Impact
The position owner's minting could be suspended for an extended period, potentially indefinitely if the attack is repeated.
What the attacker needed
Challenger and bidder collude; small collateral for challenge; gas fees
The fix
The protocol should be changed so that a challenge cannot be launched and averted in the same block, ensuring the challenger has funds at risk.
How it was found
- Challenger launches a challenge with a small collateral amount.
- Bidder (colluding with challenger) bids an amount higher than the fair price, averting the challenge.
- The avert calls restrictMinting, suspending the owner's minting for an additional day.
- Challenger and bidder repeat the process to extend the suspension.
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 system, a position owner can mint tokens backed by collateral. Anyone can challenge the position by putting up collateral, and if someone else bids enough to avert the challenge, the owner's ability to mint is paused for a day. If the challenger and bidder work together, they can keep triggering this pause over and over, effectively stopping the owner from minting.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.