Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Claim liquidation escrow #2

Open
code423n4 opened this issue Jun 28, 2021 · 1 comment
Open

Claim liquidation escrow #2

code423n4 opened this issue Jun 28, 2021 · 1 comment
Labels

Comments

@code423n4
Copy link
Contributor

Handle

gpersoon

Vulnerability details

Impact

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 claimReceipt with the receiptId of the executed order, within the required period (e.g. 15 minutes)

Proof of Concept

// https://github.com/code-423n4/2021-06-tracer/blob/main/src/contracts/Trader.sol#L67
function executeTrade(Types.SignedLimitOrder[] memory makers, Types.SignedLimitOrder[] memory takers) external override {

https://github.com/code-423n4/2021-06-tracer/blob/main/src/contracts/Liquidation.sol#L394
function claimReceipt( uint256 receiptId, Perpetuals.Order[] memory orders, address traderContract) external override {

Tools Used

Recommended Mitigation Steps

perhaps limit who can call executeTrade

@code423n4 code423n4 added bug Something isn't working 2 (Med Risk) labels Jun 28, 2021
code423n4 added a commit that referenced this issue Jun 28, 2021
@raymogg
Copy link
Collaborator

raymogg commented Jul 5, 2021

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants