Skip to main content

SoK: Mitigation of Front-Running in Decentralized Finance

  • Conference paper
  • First Online:
Financial Cryptography and Data Security. FC 2022 International Workshops (FC 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13412))

Included in the following conference series:

  • 476 Accesses

Abstract

Front-running is the malicious, and often illegal, act of both manipulating the order of pending trades and injecting additional trades to make a profit at the cost of other users. In decentralized finance (DeFi), front-running strategies exploit both public knowledge of user trades from transactions pending on the network and the miner’s ability to determine the final transaction order. Given the financial loss and increased transaction load resulting from adversarial front-running in decentralized finance, novel cryptographic protocols have been proposed to mitigate such attacks in the permission-less blockchain setting. We systematize and discuss the state-of-the-art of front-running mitigation in decentralized finance, and illustrate remaining attacks and open challenges.

J. Hsin-yu Chiang—This work was supported by the PhD School of DTU Compute.

B. David—This work was supported by the Concordium Foundation and by the Independent Research Fund Denmark (IRFD) grants number 9040-00399B (TrA2C), 9131-00075B (PUMA) and 0165-00079B.

T. K. Frederiksen—This work was supported by “Sikker brug af følsomme data”, Performance Contract 2020 and “Digital sikkerhed, tillid og dataetik”, Performance Contract 2021–2024, Ministry of Higher Education and Science, Denmark”.

L. Gentile—This work was supported by the Concordium Foundation.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    e.g. AMM swap parameters which cannot be executed in the current AMM state.

References

  1. Abraham, I., Pinkas, B., Yanai, A.: Blinder-scalable, robust anonymous committed broadcast. In: Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, pp. 1233–1252 (2020). https://doi.org/10.1145/3372297.3417261

  2. Angeris, G., Evans, A., Chitra, T.: A Note on Privacy in Constant Function Market Makers. arXiv preprint arXiv:2103.01193 (2021). https://arxiv.org/abs/2103.01193

  3. Avalanche: Apricot Phase Four: Snowman++ and Reduced C-Chain Transaction Fees. https://medium.com/avalancheavax/apricot-phase-four-snowman-and-reduced-c-chain-transaction-fees-1e1f67b42ecf(2021)

  4. Bartoletti, M., Chiang, J.H., Lluch-Lafuente, A.: A theory of automated market makers in DeFi. In: Damiani, F., Dardha, O. (eds.) COORDINATION 2021. LNCS, vol. 12717, pp. 168–187. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-78142-2_11

    Chapter  Google Scholar 

  5. Bartoletti, M., Chiang, J.H.Y., Lluch-Lafuente, A.: Maximizing Extractable Value from Automated Market Makers. arXiv preprint arXiv:2106.01870 (2021). to appear in FC’22. https://arxiv.org/pdf/2106.01870

  6. Baum, C., David, B., Dowsley, R.: Insured MPC: efficient secure computation with financial penalties. In: Bonneau, J., Heninger, N. (eds.) FC 2020. LNCS, vol. 12059, pp. 404–420. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-51280-4_22

    Chapter  MATH  Google Scholar 

  7. Baum, C., David, B., Frederiksen, T.K.: P2DEX: privacy-preserving decentralized cryptocurrency exchange. In: Sako, K., Tippenhauer, N.O. (eds.) ACNS 2021. LNCS, vol. 12726, pp. 163–194. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-78372-3_7

    Chapter  Google Scholar 

  8. Beerliová-Trubíniová, Z., Hirt, M.: Efficient multi-party computation with dispute control. In: Halevi, S., Rabin, T. (eds.) TCC 2006. LNCS, vol. 3876, pp. 305–328. Springer, Heidelberg (2006). https://doi.org/10.1007/11681878_16

    Chapter  Google Scholar 

  9. Ben-Sasson, E., Chiesa, A., Genkin, D., Tromer, E., Virza, M.: SNARKs for C: verifying program executions succinctly and in zero knowledge. In: Canetti, R., Garay, J.A. (eds.) CRYPTO 2013. LNCS, vol. 8043, pp. 90–108. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40084-1_6

    Chapter  MATH  Google Scholar 

  10. Bendlin, R., Damgård, I., Orlandi, C., Zakarias, S.: Semi-homomorphic encryption and multiparty computation. In: Paterson, K.G. (ed.) EUROCRYPT 2011. LNCS, vol. 6632, pp. 169–188. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-20465-4_11

    Chapter  Google Scholar 

  11. Boneh, D., Naor, M.: Timed commitments. In: Bellare, M. (ed.) CRYPTO 2000. LNCS, vol. 1880, pp. 236–254. Springer, Heidelberg (2000). https://doi.org/10.1007/3-540-44598-6_15

    Chapter  Google Scholar 

  12. Breidenbach, L., Daian, P., Tramèr, F., Juels, A.: Enter the hydra: towards principled bug bounties and exploit-resistant smart contracts. In: 27th USENIX Security Symposium (USENIX Security 18), pp. 1335–1352. USENIX Association, Baltimore, MD, August 2018. https://www.usenix.org/conference/usenixsecurity18/presentation/breindenbach

  13. Bünz, B., Bootle, J., Boneh, D., Poelstra, A., Wuille, P., Maxwell, G.: Bulletproofs: short proofs for confidential transactions and more. In: 2018 IEEE Symposium on Security and Privacy (SP), pp. 315–334. IEEE (2018). https://doi.org/10.1109/SP.2018.00020

  14. Burdges, J., De Feo, L.: Delay encryption. In: Canteaut, A., Standaert, F.-X. (eds.) EUROCRYPT 2021. LNCS, vol. 12696, pp. 302–326. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-77870-5_11

    Chapter  Google Scholar 

  15. Canetti, R., Lindell, Y., Ostrovsky, R., Sahai, A.: Universally composable two-party and multi-party secure computation. In: 34th ACM STOC, pp. 494–503. ACM Press, Montréal, Québec, Canada, 19–21 May 2002. https://doi.org/10.1145/509907.509980

  16. Chitra, T., Angeris, G., Evans, A.: Differential privacy in constant function market makers. Cryptology ePrint Archive (2021). https://eprint.iacr.org/2021/1101

  17. Chu, S., Xia, Y., Zhang, Z.: Manta: a plug and play private DeFi stack (2021). https://eprint.iacr.org/2021/743

  18. Daian, P., et al.: Flash boys 2.0: frontrunning in decentralized exchanges, miner extractable value, and consensus instability. In: IEEE Symposium on Security and Privacy, pp. 910–927. IEEE (2020). https://doi.org/10.1109/SP40000.2020.00040

  19. Damgård, I., Nielsen, J.B.: Scalable and unconditionally secure multiparty computation. In: Menezes, A. (ed.) CRYPTO 2007. LNCS, vol. 4622, pp. 572–590. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74143-5_32

    Chapter  Google Scholar 

  20. Damgård, I., Pastro, V., Smart, N., Zakarias, S.: Multiparty computation from somewhat homomorphic encryption. In: Safavi-Naini, R., Canetti, R. (eds.) CRYPTO 2012. LNCS, vol. 7417, pp. 643–662. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-32009-5_38

    Chapter  Google Scholar 

  21. Danos, V., Khalloufi, H.E., Prat, J.: Global order routing on exchange networks. In: Bernhard, M., et al. (eds.) FC 2021. LNCS, vol. 12676, pp. 207–226. Springer, Heidelberg (2021). https://doi.org/10.1007/978-3-662-63958-0_19

    Chapter  Google Scholar 

  22. Desmedt, Y., Frankel, Y.: Threshold cryptosystems. In: Brassard, G. (ed.) CRYPTO 1989. LNCS, vol. 435, pp. 307–315. Springer, New York (1990). https://doi.org/10.1007/0-387-34805-0_28

    Chapter  Google Scholar 

  23. Eskandari, S., Moosavi, S., Clark, J.: SoK: transparent dishonesty: front-running attacks on blockchain. In: Bracciali, A., Clark, J., Pintore, F., Rønne, P.B., Sala, M. (eds.) FC 2019. LNCS, vol. 11599, pp. 170–189. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-43725-1_13

    Chapter  Google Scholar 

  24. da Gama, M.B., Cartlidge, J., Polychroniadou, A., Smart, N.P., Alaoui, Y.T.: Kicking-the-bucket: fast privacy-preserving trading using buckets. Cryptology ePrint Archive, Report 2021/1549 (2021). to appear in FC’22, https://ia.cr/2021/1549

  25. Gennaro, R., Gentry, C., Parno, B., Raykova, M.: Quadratic span programs and succinct NIZKs without PCPs. In: Johansson, T., Nguyen, P.Q. (eds.) EUROCRYPT 2013. LNCS, vol. 7881, pp. 626–645. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-38348-9_37

    Chapter  Google Scholar 

  26. Gentry, C.: Fully homomorphic encryption using ideal lattices. In: Proceedings of the Forty-First Annual ACM Symposium on Theory of Computing, pp. 169–178. STOC ’09, Association for Computing Machinery, New York, NY, USA (2009). https://doi.org/10.1145/1536414.1536440

  27. Goldreich, O., Micali, S., Wigderson, A.: How to play any mental game or a completeness theorem for protocols with honest majority. In: Aho, A. (ed.) 19th ACM STOC, pp. 218–229. ACM Press, New York City, NY, USA, 25–27 May 1987. https://doi.org/10.1145/28395.28420

  28. Groth, J.: Short pairing-based non-interactive zero-knowledge arguments. In: Abe, M. (ed.) ASIACRYPT 2010. LNCS, vol. 6477, pp. 321–340. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-17373-8_19

    Chapter  Google Scholar 

  29. Groth, J.: On the size of pairing-based non-interactive arguments. In: Fischlin, M., Coron, J.-S. (eds.) EUROCRYPT 2016. LNCS, vol. 9666, pp. 305–326. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49896-5_11

    Chapter  Google Scholar 

  30. Kelkar, M., Deb, S., Kannan, S.: Order-fair consensus in the permissionless setting. IACR Cryptology ePrint Archive, vol. 2021, p. 139 (2021). https://eprint.iacr.org/2021/139

  31. Kelkar, M., Deb, S., Long, S., Juels, A., Kannan, S.: Themis: fast, strong order-fairness in byzantine consensus. Cryptology ePrint Archive (2021). https://eprint.iacr.org/2021/1465

  32. Khalil, R., Gervais, A., Felley, G.: Tex-a securely scalable trustless exchange. Cryptology ePrint Archive (2019). https://eprint.iacr.org/2019/265

  33. Kiayias, A., Zhou, H.-S., Zikas, V.: Fair and robust multi-party computation using a global transaction ledger. In: Fischlin, M., Coron, J.-S. (eds.) EUROCRYPT 2016. LNCS, vol. 9666, pp. 705–734. Springer, Heidelberg (2016). https://doi.org/10.1007/978-3-662-49896-5_25

    Chapter  Google Scholar 

  34. Kursawe, K.: Wendy, the good little fairness widget: achieving order fairness for blockchains. In: Proceedings of the 2nd ACM Conference on Advances in Financial Technologies, pp. 25–36 (2020). https://doi.org/10.1145/3419614.3423263

  35. Li, Y.: HoneyBadgerSwap: Making MPC as a Sidechain (2021). https://medium.com/initc3org/honeybadgerswap-making-mpc-as-a-sidechain-364bebdb10a5

  36. Lu, D., Yurek, T., Kulshreshtha, S., Govind, R., Kate, A., Miller, A.: Honeybadgermpc and asynchromix: practical asynchronous mpc and its application to anonymous communication. In: Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, pp. 887–903 (2019). https://doi.org/10.1145/3319535.3354238

  37. Maxwell, G.: Confidential transactions (2016). https://people.xiph.org/greg/confidential_values.txt

  38. Paradigm: Ethereum is a Dark Forest (2020). https://www.paradigm.xyz/2020/08/ethereum-is-a-dark-forest/

  39. Parno, B., Howell, J., Gentry, C., Raykova, M.: Pinocchio: nearly practical verifiable computation. In: 2013 IEEE Symposium on Security and Privacy, pp. 238–252. IEEE (2013). https://doi.org/10.1109/SP.2013.47

  40. Penumbra: ZSwap documentation (2021). https://protocol.penumbra.zone/main/zswap.html

  41. Perez, D., Werner, S.M., Xu, J., Livshits, B.: Liquidations: DeFi on a knife-edge. In: Borisov, N., Diaz, C. (eds.) FC 2021. LNCS, vol. 12675, pp. 457–476. Springer, Heidelberg (2021). https://doi.org/10.1007/978-3-662-64331-0_24

    Chapter  Google Scholar 

  42. Rivest, R.L., Shamir, A., Wagner, D.A.: Time-locked Puzzles and Time-release Crypto (1996). https://people.csail.mit.edu/rivest/pubs/RSW96.pdf

  43. Sasson, E.B., et al.: Zerocash: decentralized anonymous payments from bitcoin. In: 2014 IEEE Symposium on Security and Privacy, pp. 459–474. IEEE (2014). https://doi.org/10.1109/SP.2014.36

  44. Shutter: Shutter Network (2022). https://shutter.network/

  45. Wang, Y., Chen, Y., Deng, S., Wattenhofer, R.: Cyclic arbitrage in decentralized exchange markets. SSRN 3834535 (2021). https://dx.doi.org/10.2139/ssrn.3834535

  46. White, D., Robinson, D., Adams, H.: Time-weighted average market maker (TWAMM) (2021). https://www.paradigm.xyz/2021/07/twamm/

  47. Yao, A.C.C.: Theory and applications of trapdoor functions (extended abstract). In: 23rd FOCS, pp. 80–91. IEEE Computer Society Press, Chicago, Illinois, 3–5 November 1982. https://doi.org/10.1109/SFCS.1982.45

  48. Zhou, L., Qin, K., Cully, A., Livshits, B., Gervais, A.: On the just-in-time discovery of profit-generating transactions in DeFi protocols. arXiv preprint arXiv:2103.02228 (2021). https://arxiv.org/abs/2103.02228

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to James Hsin-yu Chiang .

Editor information

Editors and Affiliations

Appendices

A Example: AMM Sandwich

We illustrate a step-wise execution of a sandwich in Fig. 5 and introduce notation for user and AMM state proposed in [4] for this purpose. The wallet of is modelled as the term , where \(v_0,..., v_n\) are the respective balances of token types . The state of an AMM holding token types and is given by its reserve balances . Thus, we express the system state as a composition of wallets and reserve balances.

figure as

Let the initial AMM balance be . User wishes to perform the swap . For simplicity, we assume unit values of and to be equal: given the ratio of AMM reserves is 1, there is no arbitrage opportunity to be exploited [4]. If ’s order is executed immediately, receives for the it sends to the AMM. Instead, however, if the user swap is sandwiched by attacker (Fig. 5), only obtains the minimum amount , implying a reduction of . Note that the reserve product is maintained at each execution step and that the sandwich execution preserves the initial reserve ratio: the attack leaves no arbitrage opportunity unexploited. The attacker ’s profit of 5 units of (or ) is optimal [5]: receives the minimum amount possible, namely its swap limit.

Fig. 5.
figure 5

Sandwich attack

B Example: Speculative Sandwich

An execution of a speculative sandwich is shown in Figs. 6 and 7: here, adversary observes victim ’s interaction with an AMM which batches blinded inputs. has a public balance of only, allowing to infer that can only perform a left swap from to with an input amount of at most . The attack strategy is executed over two subsequent rounds beginning in the initial state shown in Fig. 6, where we assume unit values of and are equal.

Fig. 6.
figure 6

Successful speculative sandwich

In the first round \(\textsf{r}\), submits the front-run swap in the same direction as the victim’s, with arbitrarily chosen input amount . The minimum output amount or swap limit of the front-run is then is chosen to be such that \((100+7) \cdot (100-6.5) = 100^2\) holds: thus, if the front-run were executed in the initial state, would receive exactly its swap limit. Since all other user orders (other than the victim swap of ) are suppressed, there is a probability of 0.5 that the front-run is randomly evaluated before the victim’s swap, as shown in Fig. 6. The back-run swap of in the opposing direction then follows in the subsequent round with probability 1, since suppresses all user actions other than its own back-run. Assuming equal unit value of both token types, the attack profit for is 3.5.

Should the front-run ordering fail (Fig. 7), then ’s front-run parameters are chosen such that the front-run swap will not execute, resulting in an abort of the speculative sandwich attack. This is due to the chosen front-run parameters: following the execution step of ’s swap in Fig. 7, the constant product invariant can only hold if receives for the it sends: . However, this contradicts swap limit of , such that the front-run cannot execute in the state following ’s swap. can still perform a back-run in round \(\mathsf r+1\), thereby restoring the initial reserve ratio and extracting an arbitrage profit of 2, which is less than in the successful speculative sandwich execution in Fig. 6. Still, the speculative sandwich attack is always profitable, as shown in Appendix C.

Fig. 7.
figure 7

Aborted speculative sandwich

C Formalization: Speculative Sandwich

We formalize the example attack trace introduced in Fig. 4 and prove that the attack strategy is either profitable or cost-neutral for the attacker. Again, we assume unit value of to be equal, and the initial AMM reserve state to be : in this state, there is no arbitrage opportunity to be exploited, simplifying our analysis. We omit both AMM and transaction fees.

The victim swap direction is left, inferred by from ’s public balance of ( holds no units of ). The attack strategy is as follows:

  1. 1.

    Round \(\textbf{r}\): Front-run victim with such that

    (1)
  2. 2.

    Round \(\textbf{r}+1\): Back-run victim in opposing direction to reestablish initial AMM reserve ratio, or if attacker balance is insufficient, back-run with largest amount available to attacker .

We must show that this strategy is always profitable (when the victim swap direction can be inferred by the attacker). We note that there are several variables beyond the attackers control. The ordering of both front-run and victim swap in round r is random. Thus the desired “front-run” ordering of the victim swap in round r may not succeed (the sandwich is unsuccessful if the victim swap precedes attacker front-run swap). Furthermore, the victim swap parameters can be arbitrarily chosen, so that the victim swap may not be enabled or execute in a given sequence. Thus, we must exhaustively demonstrate the profitability of the attacker strategy for all possible cases:

  1. 1)

    Successful sandwich & enabled victim swap

  2. 2)

    Successful sandwich & disabled victim swap

  3. 3)

    Unsuccessful sandwich & enabled victim swap

  4. 4)

    Unsuccessful sandwich & disabled victim swap

Case 1: (successful sandwich & enabled victim swap): We illustrate the symbolic execution of the attack trace below in terms of initial balances, chosen swap parameters and exchanged amounts.

figure cx

We show that the attack is profitable. For and of equal unit value, the net change in value exchanged by must be positive. Thus, we must prove

(2)

Note that the amounts exchanged in the front-run are equal to the front-run parameters (), as they are chosen such that (1) holds. We consider the sub-case (a) in which the attacker has sufficient balance to perform the back-run swap such that the AMM reserves are restored to the original state and the sub-case (b) in which the attacker initially has no balance of to perform the back-run: . Here, the funds of required to execute the back-run are received entirely in the front-run execution.

For sub-case (a), we rewrite (2) in terms of independently chosen parameters , (the attacker only knows the victim swap direction) and initial reserve amounts \({\textsf{r}_{}}\). The reserves of the AMM are restored to the initial state in final state : summing all step changes to the reserves across the sandwich execution yields

figure dj

or

figure dk

Inserting RHS of equations above into our proof obligation (2) yields

(3)

To evaluate whether this inequality holds, we must solve for in terms of and chosen independently by the victim and adversary respectively. We exploit the constant reserve product invariant which holds for across the entire execution.

figure do

We can derive from the first equation, and substitute the RHS for in the second equation to obtain

figure dr

Solving for ...

figure dt

and substituting the RHS for in the proof obligation in (3) finally yields

(4)

The fraction expression above is less than 1 for any choice of positive and as the numerator is smaller than the denominator. The attacker profit is thus positive and increases with , justifying the front-run swap by .

Next, we consider the sub-case (b), where the attacker initially has no balance of , and restate the profit of attacker for the reader’s convenience.

figure ea

We assume initial attacker balance in to be , so that all the amount of available for the back-run in state is received in the front-run: thus, substituting into the equation above yields

(5)

To prove this inequality, we solve for in terms of and chosen independently by the victim and adversary respectively and initial reserves amounts \({\textsf{r}_{}}\). We exploit the constant reserve product invariant which holds throughout the execution.

figure ej

Since is assumed in sub-case (b), the 3rd equation (back-run) yields

(6)

From the 2nd equation (victim swap), we solve for in terms of independent parameters , and \({\textsf{r}_{}}\)

figure eo

From the 1st equation (front-run) , so we can rewrite the above as

figure eq

Substituting the RHS above for in the denominator expression of (6) and then substituting the RHS of (6) for in (5) yields

(7)

The attacker profit is positive but strictly less than the gain (4) obtained in sub-case (a).

Case 2 (successful sandwich & disabled victim swap): Should the victim swap not execute in round r, then can simply revert the state of the AMM with a back-run in the round \(r+1\) with the same parameter values as in the front-run.

figure eu

The attack execution is trivially cost-neutral for .

Case 3 (failed sandwich & enabled victim swap): We must show that the attacker front-run must be disabled assuming the attacker parameters are chosen as described in the attack strategy. Further, we can demonstrate that the back-run by the attacker is profitable.

figure ew

As described in step (1) of attack strategy, ’s front-run parameters are chosen such that

(8)

Thus, the front-run swap is only enabled if the received amount is equal or greater to shown above. Note, that this doesn’t hold if the front-run is executed in state of case (3) following the enabled victim swap. We prove this by contradiction: assume that the front-run executes following the victim swap, then the constant reserve product invariant must hold.

figure fa

We solve for in the first equation and insert into the second equation to obtain

figure fc

Further, we solve for in terms of \({\textsf{r}_{}}\), and

figure fg
figure fh

Comparing with in (8), we can infer the following inequality

figure fj

which cannot hold in a valid execution by definition of swaps: a user cannot receive less than the chosen swap limit. Thus, the front-run cannot be enabled in state of case (3).

Next, we prove the profitability of the back-run. Assuming a sufficient balance of the attacker to revert the effect of the victim swap, the swap parameters of the back-run can be chosen to reverse the affects of victim swap on the AMM reserves, which observes following the output-phase of round r: namely, and . We insert these into the reserve product invariant from the victim swap

figure fo

to obtain

figure fp

For equal unit value of both token types, this is clearly profitable, as receives more value () as it sends (). If attacker has no balance of it simply omits the back-run and the attack is aborted, resulting in a cost-neutral execution for the attacker.

Case 4 (failed sandwich & disabled victim swap): As in case (2) - should the victim swap not execute in round \(\mathsf r\), then can simply revert the state of the AMM with a back-run in the round \(\mathsf r+1\)

figure fv

The attack execution is trivially cost-neutral for .

D Speculative Sandwich with Private User Balances

Importantly, when performing the speculative AMM swap attack as shown in C, the direction of the victim swap must be known. If user balances are private, will have to guess the direction of the front-running swap. However, this is not a profitable strategy: an incorrect guess can result in a loss for as shown in the trivial example execution below.

figure fz

Again, assuming equal unit value of and , realizes a loss of \(7+15-21.5 = 0.5\). No back-run swap is possible that extracts any arbitrage value given that the reserve ratio is already consistent with the assumption that unit values of and are equal [4]. Thus, speculative sandwich attacks are only rational if the victim swap direction can be inferred, motivating the need for private user balances.

E Example: Speculative Sandwich of Scheduled Swap

We illustrate an example of a sandwich of a scheduled swap. Such an attack can be exploited despite the batching of blinded user inputs Sect. 3.2, as long as input schedules remain public. Let be a swap action that is scheduled to execute as soon as possible following block-chain round \(\mathsf r\), thus requiring no further interaction from the user. Further, let the set of scheduled swap orders be captured in a publicly observable state fragment, i.e. . In practice, such a scheduled swap order will be evaluated prior to the first swap order in round \(\textsf{r}+1\), so that it is not possible for the adversary to place a front-run swap before it in round \(\textsf{r}+1\).

However, the sandwich attack can still be executed by an adversary which prevents honest users from submitting swap. The adversary simply submits the front-run to round \(\mathsf r\), and the back-run to round \(\mathsf r+1\), whilst suppressing all other user inputs.

figure gh

We emphasize that scheduled swap orders do not require the submitting user to participate in the round it is scheduled: it is evaluated automatically by the application. Furthermore, since the victim’s swap parameters are public, the front-run and back-run parameters can be chosen to optimize ’s profit.

F Speculative Sandwich in Hash-Based Commit and Reveal Schemes

As shown in Appendix C, the speculative sandwich attack is rational as long as the direction of the victim swap is known. Hash-based commit & reveal schemes suffer from selective output by the adversary (Fig. 3), permitting a speculative attack to succeed even if the swap direction cannot be inferred from public user balances. Here the attacker simply commits two front-run swaps of opposing directions in the same round as the victim swap, whilst suppressing other user inputs. In the output-phase, the adversary learns the direction of the victim swap before having to open its own commitments and selectively opens the front-run of the same direction as the victim swap, whilst refraining from opening the other front-run swap. The back-run is then executed as in Appendix C.

Rights and permissions

Reprints and permissions

Copyright information

© 2023 International Financial Cryptography Association

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Baum, C., Hsin-yu Chiang, J., David, B., Frederiksen, T.K., Gentile, L. (2023). SoK: Mitigation of Front-Running in Decentralized Finance. In: Matsuo, S., et al. Financial Cryptography and Data Security. FC 2022 International Workshops. FC 2022. Lecture Notes in Computer Science, vol 13412. Springer, Cham. https://doi.org/10.1007/978-3-031-32415-4_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-32415-4_17

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-32414-7

  • Online ISBN: 978-3-031-32415-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics