The funding rate is implemented wrong, attackers can use this to backrun other users for a profit.
The attack vector involves creating an order, waiting for another user to make an order in the same market, then immediately close the order for a profit.
Consider the following attack flow
Zaros is deployed, markets open
Attacker sees the DOGE market is open so he makes the first long order
Normal user comes in and makes a long order
Attacker backruns the honest user's Tx by closing their initial long position, for a profit
Here is a coded POC proving the issue, see the console output for the PNL of the attacker and victim
Add the following to createMarketOrder.t.sol
Looking through the logs for naruto the attacker here, he made a pnl = 388187320537500000 [3.881e17]
on the other hand the innocent user made a pnl = -388187320537500000 [-3.881e17]
Risk free trades for attackers
Manual Review
redo the implementation of the funding rate and test it heavily
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.