Frontrunning is a blockchain attack where an attacker exploits transaction ordering. In public blockchains, transactions sit in a mempool (visible to everyone) before being included in a block. An attacker sees a pending transaction, submits their own higher-priority transaction (higher gas), and extracts value from the ordering. Example: Attacker sees a large DEX trade pending. Attacker sends their own trade with higher gas fee, gets included first, pushes the price up, then victim's trade executes at worse price. Attacker profits, victim loses.