Detection of MEV Sandwich Opportunities via Smart Contract Control Flow Graphs
Abstract
As Finanças Descentralizadas (DeFi) têm transformado o ecossistema financeiro ao permitir negociações sem intermediários, mas também introduz novos vetores de ataque. Estratégias do tipo Sanduíche MEV exploram configurações inseguras de derrapagem de preço em trocas descentralizadas, gerando perdas financeiras significativas aos usuários. Enquanto as mitigações atuais focam predominantemente na camada de rede, há uma lacuna em ferramentas preventivas de auditoria de código. Este trabalho propõe uma abordagem de análise estática baseada em Gráfico de Fluxo de Controle para detectar a ausência de proteções de limite de preço em contratos inteligentes. Nossa metodologia rastreia o código de contratos inteligentes Solidity da rede Ethereum, visando identificar parâmetros inseguros ou não validados pelo usuário. Resultados preliminares demonstram que o detector alcançou uma acurácia de 78,9% em protocolos DeFi reais, contribuindo para a segurança preventiva em redes Blockchain.References
Bodell III, W. E., Meisami, S., and Duan, Y. (2023). Proxy hunting: Understanding and characterizing proxy-based upgradeable smart contracts in blockchains. In 32nd USENIX Security Symposium (USENIX Security 23), pages 1829–1846.
Campos, J. N., de Carvalho, L. H., Oliveira, I. R., Silva, A. C., Falcao, I. G., da Silva, M. J., Gonçalves, G. D., Vieira, A. B., and Nacif, J. A. (2025a). Análise das ferramentas de detecçao de vulnerabilidades para contratos inteligentes de blockchains evm. In Workshop em Blockchain: Teoria, Tecnologias e Aplicações (WBlockchain), pages 126–139. SBC.
Campos, J. N. and et al. (2024). Finanças descentralizadas em redes blockchain: Perspectivas sobre pesquisa e inovação em aplicações, interoperabilidade e segurança. In Jornada de Atualização em Informática 2024, volume 44 of Congresso da Sociedade Brasileira de Computação, pages 7–56. SBC, Porto Alegre, 43nd edition.
Campos, J. N., Oliveira, I. R., Fontinele, A., Gonçalves, G. D., Vieira, A. B., and Nacif, J. A. M. (2025b). Impacto do paradigma de separação proponente-construtor em ataques sanduíche na rede ethereum. In Simpósio Brasileiro de Redes de Computadores e Sistemas Distribuídos (SBRC), pages 756–769. SBC.
Chaliasos, S., Charalambous, M. A., Zhou, L., Galanopoulou, R., Gervais, A., Mitropoulos, D., and Livshits, B. (2024). Smart contract and defi security tools: Do they meet the needs of practitioners? In Proceedings of the 46th IEEE/ACM International Conference on Software Engineering, pages 1–13.
Chu, H., Zhang, P., Dong, H., Xiao, Y., Ji, S., and Li, W. (2023). A survey on smart contract vulnerabilities: Data sources, detection and repair. Information and Software Technology, 159:107221.
Contro, F., Crosara, M., Ceccato, M., and Dalla Preda, M. (2021). Ethersolve: Computing an accurate control-flow graph from ethereum bytecode. In 2021 IEEE/ACM 29th International Conference on Program Comprehension (ICPC), pages 127–137. IEEE.
Feist, J., Grieco, G., and Groce, A. (2019). Slither: a static analysis framework for smart contracts. In 2019 IEEE/ACM 2nd International Workshop on Emerging Trends in Software Engineering for Blockchain (WETSEB), pages 8–15. IEEE.
Ferreira Torres, C., Mamuti, A., Weintraub, B., Nita-Rotaru, C., and Shinde, S. Rolling in the shadows: Analyzing the extraction of mev across layer-2 rollups. In Proceedings of the ACM SIGSAC Conference on Computer and Communications Security.
Fontinele, A., Campos, J. N., Oliveira, I. R., Gonçalves, G. D., Nacif, J. A., Vieira, A. B., and Soares, A. C. (2024). Análise de ataques sanduíche sob as transações da blockchain ethereum. In Simpósio Brasileiro de Redes de Computadores e Sistemas Distribuídos (SBRC), pages 728–741. SBC.
Ivanov, N., Li, C., Yan, Q., Sun, Z., Cao, Z., and Luo, X. (2023). Security threat mitigation for smart contracts: A comprehensive survey. ACM Computing Surveys, 55(14s):1–37.
Kong, J. (2025). Sadt: Sandwich attack detection for transactions on decentralized exchanges. In Ubiquitous Security: 4th International Conference, UbiSec 2024, Changsha, China, December 29–31, 2024, Revised Selected Papers, volume 2469, page 145. Springer Nature.
Kong, Q., Chen, J., Wang, Y., Jiang, Z., and Zheng, Z. Defitainter: Detecting price manipulation vulnerabilities in defi protocols. In Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis.
Weintraub, B., Torres, C. F., Nita-Rotaru, C., and State, R. (2022). A flash (bot) in the pan: measuring maximal extractable value in private pools. In Proceedings of the 22nd ACM Internet Measurement Conference, pages 458–471.
Wu, C., Chen, L., Wang, K., Han, W., and Chai, H. (2025). Sandwatch: Towards detecting sandwich attacks in ethereum using a dual-task graph neural network. ACM Transactions on the Web.
Xie, M., Hu, M., Kong, Z., Zhang, C., Feng, Y., Wang, H., Xue, Y., Zhang, H., Liu, Y., and Liu, Y. (2024). Defort: Automatic detection and analysis of price manipulation attacks in defi applications. In Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, pages 402–414.
Zhou, L., Qin, K., Torres, C. F., Le, D. V., and Gervais, A. (2021). High-frequency trading on decentralized on-chain exchanges. In 2021 IEEE Symposium on Security and Privacy (SP), pages 428–445. IEEE.
Campos, J. N., de Carvalho, L. H., Oliveira, I. R., Silva, A. C., Falcao, I. G., da Silva, M. J., Gonçalves, G. D., Vieira, A. B., and Nacif, J. A. (2025a). Análise das ferramentas de detecçao de vulnerabilidades para contratos inteligentes de blockchains evm. In Workshop em Blockchain: Teoria, Tecnologias e Aplicações (WBlockchain), pages 126–139. SBC.
Campos, J. N. and et al. (2024). Finanças descentralizadas em redes blockchain: Perspectivas sobre pesquisa e inovação em aplicações, interoperabilidade e segurança. In Jornada de Atualização em Informática 2024, volume 44 of Congresso da Sociedade Brasileira de Computação, pages 7–56. SBC, Porto Alegre, 43nd edition.
Campos, J. N., Oliveira, I. R., Fontinele, A., Gonçalves, G. D., Vieira, A. B., and Nacif, J. A. M. (2025b). Impacto do paradigma de separação proponente-construtor em ataques sanduíche na rede ethereum. In Simpósio Brasileiro de Redes de Computadores e Sistemas Distribuídos (SBRC), pages 756–769. SBC.
Chaliasos, S., Charalambous, M. A., Zhou, L., Galanopoulou, R., Gervais, A., Mitropoulos, D., and Livshits, B. (2024). Smart contract and defi security tools: Do they meet the needs of practitioners? In Proceedings of the 46th IEEE/ACM International Conference on Software Engineering, pages 1–13.
Chu, H., Zhang, P., Dong, H., Xiao, Y., Ji, S., and Li, W. (2023). A survey on smart contract vulnerabilities: Data sources, detection and repair. Information and Software Technology, 159:107221.
Contro, F., Crosara, M., Ceccato, M., and Dalla Preda, M. (2021). Ethersolve: Computing an accurate control-flow graph from ethereum bytecode. In 2021 IEEE/ACM 29th International Conference on Program Comprehension (ICPC), pages 127–137. IEEE.
Feist, J., Grieco, G., and Groce, A. (2019). Slither: a static analysis framework for smart contracts. In 2019 IEEE/ACM 2nd International Workshop on Emerging Trends in Software Engineering for Blockchain (WETSEB), pages 8–15. IEEE.
Ferreira Torres, C., Mamuti, A., Weintraub, B., Nita-Rotaru, C., and Shinde, S. Rolling in the shadows: Analyzing the extraction of mev across layer-2 rollups. In Proceedings of the ACM SIGSAC Conference on Computer and Communications Security.
Fontinele, A., Campos, J. N., Oliveira, I. R., Gonçalves, G. D., Nacif, J. A., Vieira, A. B., and Soares, A. C. (2024). Análise de ataques sanduíche sob as transações da blockchain ethereum. In Simpósio Brasileiro de Redes de Computadores e Sistemas Distribuídos (SBRC), pages 728–741. SBC.
Ivanov, N., Li, C., Yan, Q., Sun, Z., Cao, Z., and Luo, X. (2023). Security threat mitigation for smart contracts: A comprehensive survey. ACM Computing Surveys, 55(14s):1–37.
Kong, J. (2025). Sadt: Sandwich attack detection for transactions on decentralized exchanges. In Ubiquitous Security: 4th International Conference, UbiSec 2024, Changsha, China, December 29–31, 2024, Revised Selected Papers, volume 2469, page 145. Springer Nature.
Kong, Q., Chen, J., Wang, Y., Jiang, Z., and Zheng, Z. Defitainter: Detecting price manipulation vulnerabilities in defi protocols. In Proceedings of the 32nd ACM SIGSOFT International Symposium on Software Testing and Analysis.
Weintraub, B., Torres, C. F., Nita-Rotaru, C., and State, R. (2022). A flash (bot) in the pan: measuring maximal extractable value in private pools. In Proceedings of the 22nd ACM Internet Measurement Conference, pages 458–471.
Wu, C., Chen, L., Wang, K., Han, W., and Chai, H. (2025). Sandwatch: Towards detecting sandwich attacks in ethereum using a dual-task graph neural network. ACM Transactions on the Web.
Xie, M., Hu, M., Kong, Z., Zhang, C., Feng, Y., Wang, H., Xue, Y., Zhang, H., Liu, Y., and Liu, Y. (2024). Defort: Automatic detection and analysis of price manipulation attacks in defi applications. In Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, pages 402–414.
Zhou, L., Qin, K., Torres, C. F., Le, D. V., and Gervais, A. (2021). High-frequency trading on decentralized on-chain exchanges. In 2021 IEEE Symposium on Security and Privacy (SP), pages 428–445. IEEE.
Published
2026-05-25
How to Cite
CAMPOS, Josué N.; SILVA, Aline C. S.; PASSOS, Cleidimar L. dos; GONÇALVES, Glauber D.; VIEIRA, Alex B.; NACIF, José Augusto M..
Detection of MEV Sandwich Opportunities via Smart Contract Control Flow Graphs. In: BRAZILIAN SYMPOSIUM ON COMPUTER NETWORKS AND DISTRIBUTED SYSTEMS (SBRC), 44. , 2026, Praia do Forte/BA.
Anais [...].
Porto Alegre: Sociedade Brasileira de Computação,
2026
.
p. 617-630.
ISSN 2177-9384.
DOI: https://doi.org/10.5753/sbrc.2026.19389.
