Front-running happens when someone sees a pending transaction and manages to get their own transaction processed first by offering a higher gas price. This is possible in public blockchain networks like Ethereum where transaction data is publicly accessible before being mined.
Front-running can result in financial loss, as an attacker can intercept and modify the outcome of a transaction, for instance, in a decentralized exchange trade.
An attacker on a decentralized exchange (DEX) could observe a large buy order in the transaction pool, copy it, and submit the same transaction with a higher gas price, ensuring their transaction gets mined first and potentially making a profit at the expense of the original sender.