Issue is quite complex. Let’s go in order.
After reviewing the function BuyerAgent::purchase
, it becomes clear that it only makes a purchase in the round which gives the function BuyerAgent::getRoundPhase
.Moreover buyer can buy only on BUY phase when users can create listings only on SELL phase.
The BuyerAgent::getRoundPhase
function calculates the number of rounds for each marketParametrs value in the Swan. The sum is the current round.
MarketParametrs are the Swan Market parameters that Swan Owner sets in SwanManager::setMarketParameters
. All market parameters are added to the array and can no longer be removed from it.
For each market parameter, a so-called offset round is added to the getRoundPhase
function.
Key attack idea - because of offset getRoundPhase
can skip from round n SELL phase to round n + 1 SELL phase. So round n BUY phase will skipped, and users with lists on round n, that can be bought only on round n BUY phase, will be forced to relist and pay more txes
Let the current round be - n. And in this round the owner will decide to add new marketParametrs.
If we were in (n, SELL) and owner add new market parameters we will move straight to (n + 1, SELL). Because of offset in last parametr round computation
From the same reasoning (n, BUY) -> (n + 1, SELL). (n, WITHDRAW) -> (n + 1, SELL)
Although in each case this discrete jump slightly disrupts the protocol, it is only in specific cases that it directly threatens the user’s funds.
From (n, SELL) to (n + 1, SELL)
In this case all users that listed they assets on n round simply will not have the ability to sell their asset. Since a buyer can only buy these sets in (n, BUY) however this phase will be skipped. Thus users will be forced to relist their assets and additionally pay a commission not on their own fault.
2.From (n, BUY) to (n + 1, SELL) before Buyer purchase. Consequense is same as in the previous case, but now buyer just dont call purchase in time to trigger a transaction before updating the parametrs.(It is possible because buyers dont call immideatly after BUY phase starts)
When the user adds new parameters - 50/50 chance that will happen situation described above. As a result, users who put up an asset in a certain round are forced to re-put it and pay a new fee.
Severity: Medium
Manual Review
Better controll offset addition in round calculation
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.