An attacker can create an offer and once someone takes (createTaker
) the offer, the attacker can abort the offer, thus getting all his collateral back and the tradetax as profit.
Assume the following scenario (Bob is the attacker)
Bob creates an ask offer (createOffer
) with the following parameters:
points = 100
amount = 100USDC
collateralRate = 20,000
eachTradeTax = 10,000
This would mean Bob deposits, 200USDC as collateral during the creation of the offer.
Alice takes the offer (createTaker
) and thus deposits the following:
depositAmount = 100USDC
platformFee = 0.05 USDC (assuming 0.05% platformfee)
tradeTax = 100USDC
Thus Bobs balance increases by depositAmount + tradeTax = 200USDC
Bob proceeds to abort his has offer (abortAskOffer
)
Here transferAmount is calculated as 200USDC (steps mentioned in the code below)
And the totalDepositAmount = 100USDC
And the makerRefundAmount = 100USDC which is added to BOB's balance. Thus Bob's current balance becomes 200USDC + 100USDC = 300USDC. (200 USDC was when Alice called the createTaker
function)
Thus, eventhough Bob had deposited only 200USDC (as collateral) he has got 300USDC. This increase is from the tax that Alice paid(tax = 100USDC)
Note: Here an exaggerated amount for tax is used to show the effects of the issue. In reality Bob can make many such ask offers and abort them to have a profit of the tax amount from each of those trades.
Since malicious users like Bob can use this method to risk nothing and gain a profit of the tax they can create multiple offers and deploy this strategy to gain profits. Thus, users wont be able to trust the listed offers, and will therefore stop buying from them in fear of losing money.
Manual Review
When aborting the offer, subtract the tax from the refund amount. (line 613 abortAskOffer)
Valid high severity, given orginal offer makers are not a trusted entity to enforce a settlement. The trade tax set by the maker should be returned back to the takers to avoid abuse of abortion of ask offers to steal trade tax from takers. Note for appeals period: See issue #528 for additional details
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.