Backrunning: what it is, and when it is your protocol’s problem

Table of Contents

Backrunning is placing a transaction directly after someone else’s, usually in the same block, to profit from the state their transaction leaves behind. On its own it is the mildest kind of MEV (maximal extractable value), because it does not change the result of the transaction it follows. Whether it costs your protocol anything depends on what your own code leaves lying around.

On 11 January 2024 a trader on Solana spent close to $9 million buying the memecoin dogwifhat (WIF) through a pool far too thin for the order. The Block reported a price of about $3 a token, against a market rate of about $0.20. A bot read the price that trade left in the pool and traded against it in a bundle placed straight after. In about 20 seconds it turned 703 SOL into 19,035 SOL, and tipped 890 SOL to the validator for the privilege.

The bot did not set the price the trader paid. The trader’s own order did that, and the bot collected the gap. Front-running needs to see your transaction before it lands. Backrunning only needs it to land.

This entry covers how backrunning works, how it differs from front-running and sandwich attacks, when it is harmless, and the five places a protocol creates backrun value itself. One of those five is a plain bug that often sits in a deployment script rather than a contract, which matters for what a manual smart contract audit can and cannot see.

Quick Answer

Backrunning is placing a transaction immediately after a target transaction, usually in the same block, to profit from the state it leaves behind: a moved pool price, an oracle update that makes a loan liquidatable, a pool that has just opened. Unlike front-running or a sandwich attack, it does not change the target’s own result.

Last updated October 2026.

On this page

  • How backrunning works
  • Backrunning vs front-running vs sandwich attacks
  • Is backrunning bad?
  • When a backrun is your protocol’s problem
  • What an audit can catch, and what it cannot
  • Frequently asked questions

How backrunning works

A backrunner needs two things: to know a transaction is coming, and to get its own transaction placed immediately after it. Everything else is execution.

On Ethereum the placement is done with a bundle, an ordered set of transactions handed to a block builder and included together, in that order, or not at all. If the target never lands, the backrun never runs, so the searcher pays nothing for an opportunity that did not appear. On Solana the same job runs through Jito bundles bid to the slot leader, which is how the WIF trade above was backrun.

A backrun does not even need the transaction to be public. Hiding a transaction until it is included, which is what private routing does, stops a sandwich outright. It only delays a backrun: the price gap is still there in the next block, or it is sold in an auction to the searchers who bid for it. Our mempool entry covers where pending transactions sit and who can read them.

The common ones look like this:

The transaction in frontWhat it leaves behindThe backrun
A large swap on a DEXA pool price out of line with other venuesArbitrage that trades the pool back towards the market price
An oracle price updateLoans that are now under-collateralisedA liquidation that collects the liquidation bonus
A new pool or its first liquidityA token that has just become tradeableA buy in the same block, known as sniping
A state change that unlocks a caller rewardA harvest, rebalance or settlement that anyone may callThe call, made first, to collect the reward
A contract deploymentA contract whose initialiser has not runA call to that initialiser before the team’s own

Backrunning vs front-running vs sandwich attacks

The difference is position and what the attacker needs from you. A front-run sits before your transaction and needs to see it in advance. A backrun sits after it and only needs it to execute. A sandwich attack is both at once, a buy before your swap and a sell after it.

BackrunFront-runSandwich attack
Where it sitsDirectly after your transactionDirectly before itOne transaction either side
Needs your transaction before it executesNo, only that it landsYesYes
Changes the result you getNoYes: a worse price, or a lost claim, bid or mintYes: a price at or near the worst your slippage limit allows
What it collectsThe gap or state change your transaction leftThe opportunity your transaction revealedYour slippage
Accepted by MEV-Share’s refund auctionYesNoNo

The last row is not a technicality. Flashbots’ MEV-Share documentation states: “At the moment, MEV-Share Nodes only accept backruns.” The refund markets that exist are built around the one kind of MEV that leaves your own transaction untouched.

The mempool entry covers the slippage and deadline code that limits sandwiching. This page stays with the backrun.

One transaction can be both

Position is relative.

Picture a team that deploys a contract in one transaction and calls its initialize function in a second. An attacker who calls initialize in between has backrun the deployment and front-run the team. Which word applies depends on which transaction you measure from. The fix, covered below, is the same either way.

Is backrunning bad?

On its own, rarely for the user it follows. MEV Blocker’s documentation puts it in one line: “Backrunning is only harmful to the user when combined with a frontrunning attack.”

Much of it does useful work. Arbitrage backruns pull a DEX pool back into line with every other venue, and ethereum.org calls DEX arbitrage “the simplest and most well-known MEV opportunity”. Liquidation backruns clear bad debt from lending markets quickly, because searchers race “to be the first to submit a liquidation transaction and collect the liquidation fee for themselves”.

The value a backrun collects was still created by somebody’s transaction, and two systems on Ethereum exist to hand it back:

  • MEV-Share (Flashbots) pays users by default 90% of the MEV their transactions create.
  • MEV Blocker auctions the right to backrun each transaction, and the winning builder must “refund 90% of that bid’s value to the user”, with the other 10% going to the validator.

A refund market is the clearest sign that backrun value belongs to someone. For a protocol team, the question is whether that someone is you.

When a backrun is your protocol’s problem

When your own code creates the state change. Every time a protocol moves a price, updates an oracle, opens a market, pays a caller or deploys a contract, it leaves value for whoever lands next. Almost every transaction can be backrun, so the review question is who collects the value each transaction leaves, and whether you meant to pay them.

That is our position, and it turns five ordinary operations into review items.

Oracle updates that open liquidations

An oracle update that drops a collateral price makes some loans liquidatable in the same instant. Chainlink’s documentation describes searchers who “compete to place a liquidation transaction immediately after the oracle update transaction”, and names the value OEV (oracle extractable value), “a subset of MEV created during the transmission of oracle reports onchain”. The liquidation bonus that pays them comes out of the borrower’s collateral.

Lending protocols have started to take a share back. Chainlink’s Smart Value Recapture (SVR) is “purpose-built for recapturing non-toxic liquidation-related OEV via backrunning”, runs dedicated feeds for Aave, and splits the recaptured revenue between the protocol and the Chainlink Network. If you are building a lending market, two numbers deserve a hard look: how large the liquidation bonus is against the work it pays for, and who keeps the difference.

Your own large trades

A treasury diversification, a buyback, a rebalance of protocol-owned liquidity or a vault’s strategy swap moves a pool price like any large trade. The arbitrage after it collects the price impact. The WIF trade above is the extreme case of the same mechanism.

The price impact is the cost; the backrun only decides who collects it. Splitting the order over time, settling through a batch auction or a quote-based venue, or sending it through a route that refunds backrun value keeps more of it inside the protocol.

Launches and liquidity adds

The transaction that creates a pool, adds the first liquidity or switches trading on is a magnet for backruns. Bots buy in the same block, and they are often first in line to sell to everyone who arrives later. Per-wallet caps in the opening blocks, auction-style launches and other launch designs each change who gets that first block. Each also brings its own failure modes, so the launch logic belongs in the review scope, not just the token contract.

Caller rewards and keeper bounties

Many protocols pay whoever calls a maintenance function: a harvest that compounds yield, a rebalance, an auction settlement, a liquidation. Those calls are backruns by design. The reward appears when the state changes, and the first caller after it wins.

That works when the reward matches the job. It leaks when the reward is a fixed percentage of a balance that keeps growing, when the caller can pick the moment that makes it largest, or when the caller supplies an input (a price, a route, a recipient) that the function does not check. “The caller’s reward never exceeds a stated cap” is a property you can write down and test, which is what a fuzzing campaign is for.

Two-transaction deployments

This is the backrun that is simply a bug. A contract built for a proxy pattern usually has an initialize function instead of a constructor, guarded so that it can only run once. Guarded against a second call is not the same as guarded against the wrong caller. If the deployment sends the contract and its initialisation as two separate transactions, the first caller after the deployment owns it.

A hypothetical, so the shape is clear.

A team ships a vault late on a Friday. The script deploys it in one transaction and calls initialize with the team’s multisig in the next. A bot watching for new contracts with an open initialiser lands its own call in between. The team’s call reverts with “already initialised”, and the vault, now owned by somebody else, sits at the address the frontend already points to.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

contract Vault {
    address public owner;
    bool private initialised;

    // Guarded against a second call, which is what a reviewer reading this
    // file checks. Nothing here decides who makes the first call.
    function initialize(address owner_) external {
        require(!initialised, "already initialised");
        initialised = true;
        owner = owner_;
    }

    function sweep(address payable to) external {
        require(msg.sender == owner, "not owner");
        (bool ok, ) = to.call{value: address(this).balance}("");
        require(ok, "transfer failed");
    }

    receive() external payable {}
}

// Deployment and initialisation in one transaction, so there is no gap
// between the two calls for another transaction to land in.
contract VaultFactory {
    event VaultDeployed(address indexed vault, address indexed owner);

    function deploy() external returns (Vault vault) {
        vault = new Vault();
        vault.initialize(msg.sender);
        emit VaultDeployed(address(vault), msg.sender);
    }
}

Read Vault on its own and you see an initialiser that can only run once, and you move on. The race lives in how the contract is deployed. Greg Bock’s write-up of the Cetus and Balancer losses makes the wider point about scope: “Time and budget push auditors toward the protocol’s own code first, and dependencies often get lighter scrutiny or get marked out of scope entirely.” Deployment scripts tend to land in the same place.

OpenZeppelin closes the gap from both ends. Its upgradeable contracts guide says “Do not leave an implementation contract uninitialized” and calls _disableInitializers in the implementation’s constructor. In the current Contracts 5.x documentation, the ERC1967Proxy constructor runs the initialiser call during deployment, and “By default construction will fail if _data is empty.”

What an audit can catch, and what it cannot

An audit can find the backruns your code invites: the open initialiser, the uncapped reward, the oracle path that accepts an old price. It cannot remove backrunning from a public chain, predict what searchers will extract once the market is live, or review a deployment script that nobody put in scope.

An audit can checkAn audit cannot
Whether every initialiser runs inside the deployment transaction, or is lockedConfirm that the script run on launch day is the one reviewed, unless the script is in scope
Caller rewards and liquidation bonuses against the job they pay forMeasure what searchers will actually take under live market conditions
How the oracle path handles freshness, deviation and fallbackStop searchers racing to liquidate after a valid update
Functions where being first after a state change decides the outcomeControl how your users route their transactions
Treasury and rebalance logic, and the slippage it acceptsCover code merged after the audited commit

Oracle handling is where the liquidation race starts, so it deserves its own pass. In our audit of Adrena, a perpetuals venue on Solana, the program overwrote the timestamp on an oracle price at the moment it was stored. Combined with a caller-supplied freshness parameter that had no on-chain cap, a price that was already old could pass the staleness check for roughly 20 seconds. The fix clamps the stored timestamp and rejects any quote older than the parameter allows, and the published report records it as resolved.

Fidesium’s manual smart contract audits are line-by-line human review covering logic and economic risk, with two rounds of fix verification included, from $5,000. If you take one thing from this page into a scoping call, make it this: ask for the deployment scripts and the keeper logic to be in scope. Our published reports are on the audits page, so you can see what a review covers before you book one.

A review also only describes the commit it read. A reward formula or a launch setting changed next month is a backrun nobody has looked at, which is why audits age and why post-deployment monitoring tuned to your protocol’s own logic exists.

Frequently asked questions

What is backrunning in crypto?

Backrunning is placing a transaction immediately after a target transaction, usually in the same block, to profit from the state it leaves behind, such as a moved pool price or a loan that has just become liquidatable. It does not change the target transaction’s own result.

What is the difference between backrunning and front-running?

A front-run sits before your transaction and needs to see it in advance, and it changes the result you get. A backrun sits after your transaction and only needs it to land. It collects what your transaction left behind without changing your outcome.

Is backrunning the same as a sandwich attack?

No. A sandwich attack is a front-run and a backrun together, one on each side of a swap, and its profit is your slippage. A backrun on its own does not worsen the price you receive.

Is backrunning harmful?

On its own, rarely to the user it follows. MEV Blocker’s documentation says it is “only harmful to the user when combined with a frontrunning attack.” It can still cost a protocol when the protocol’s own trades, oracle updates or caller rewards create the value a backrunner collects.

Can you get paid for being backrun?

On Ethereum, yes. Flashbots’ MEV-Share only accepts backruns and pays users by default 90% of the MEV their transactions create. MEV Blocker requires the winning builder to refund 90% of the backrun bid’s value to the user.

Does backrunning happen on Solana?

Yes. Searchers bid for bundle inclusion through Jito. In January 2024 a bot backran a trader who had paid about $3 a token for WIF against a market rate near $0.20, turning 703 SOL into 19,035 SOL in about 20 seconds, according to The Block.

Can a smart contract audit stop backrunning?

No audit removes backrunning from a public chain. An audit can find the backruns your code invites, such as an initialiser that anyone can call after deployment, an uncapped caller reward or an oracle path that accepts stale prices, provided the deployment scripts and keeper logic are in scope.

Share:

More Posts

Tell us your security needs