> For the complete documentation index, see [llms.txt](https://docs.evoq.finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.evoq.finance/security/general-risks/front-running-attack.md).

# Front-Running Attack

### Overview of Vulnerability

Front-running occurs when an attacker observes a pending transaction in the mempool and submits their own transaction with higher gas fees to gain execution priority. This behavior disrupts the fair operation of protocols, allowing attackers to exploit liquidity matching or trading opportunities.

### Potential Scenarios of Vulnerability

In Evoq’s peer-to-peer (P2P) matching system, suppliers enter a waiting queue to be matched with borrowers. A front-runner could detect an incoming borrow transaction, submit their own supply transaction in the same block with higher priority, and exploit the matching process. This would prevent legitimate suppliers in the queue from being matched, reducing efficiency and fairness within the system by taking advantage of the priority queue matching mechanism.

### Evoq’s Preventive Measures

To counteract front-running risks, Evoq ensures that supply or borrow operations are added to the matching queue starting from the block following their execution. This mechanism prevents attackers from exploiting the priority queue matching system to intentionally bypass waiting times and unfairly intercept borrow requests. By implementing this delay, Evoq ensures that the matching process remains fair and prevents attackers from gaining an unfair advantage over legitimate users.

By implementing these measures, Evoq enhances the security and fairness of its platform, offering a reliable and trustworthy system for its users.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.evoq.finance/security/general-risks/front-running-attack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
