Claim liquidation escrow
A liquidator could create a second account and execute a trade between their own accounts with large slippage, then claim the liquidation escrow for that slippage. This allowed them to get reimbursed for slippage they caused themselves.
Submitted by gpersoon
A liquidator can always claim the liquidation escrow in the following way:
- create a second account
- setup a complimentary trade in that second account, which will result in a large slippage when executed
- call
executeTrade(which everyone can call), to execute a trade between his own two accounts with a large slippage - the slippage doesn’t hurt because the liquidator owns both accounts
- call
claimReceiptwith the receiptId of the executed order, within the required period (e.g. 15 minutes)
function executeTrade(Types.SignedLimitOrder[] memory makers, Types.SignedLimitOrder[] memory takers) external override {
function claimReceipt( uint256 receiptId, Perpetuals.Order[] memory orders, address traderContract) external override {
Recommend to perhaps limit who can call executeTrade.
raymogg (Tracer) acknowledged and confirmed:
Valid issue which would allow someone to get reimbursed for slippage against themselves.
The Trader contract will have whitelisted relayers added to prevent issues like this (similar to #119)
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 executeTrade function was callable by anyone, allowing a liquidator to trade between their own accounts and then claim slippage reimbursement.
Impact
A liquidator could get reimbursed for slippage against themselves, potentially draining the liquidation escrow.
What the attacker needed
A liquidator account; ability to create a second account; call executeTrade and claimReceipt
The fix
The Trader contract should have whitelisted relayers to prevent unauthorised calls to executeTrade.
How it was found
- Create a second account.
- Set up a complimentary trade in that second account that will result in large slippage when executed.
- Call executeTrade to execute a trade between the two accounts with large slippage.
- Call claimReceipt with the receiptId of the executed order within the required period.
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.
When a trade happens at a worse price than expected, the difference is called slippage. Normally, a liquidator who suffers slippage can claim compensation from an escrow. Here, a liquidator could trade with themselves, create fake slippage, and then claim that compensation, effectively taking money from the escrow.
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.