Enforcing Control Flow Integrity on DeFi Smart Contracts

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Chen, Zhiyang, Beillahi, Sidi Mohamed, Barahimi, Pasha, Minwalla, Cyrus, Du, Han, Veneris, Andreas, Long, Fan
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866910149464031232
author Chen, Zhiyang
Beillahi, Sidi Mohamed
Barahimi, Pasha
Minwalla, Cyrus
Du, Han
Veneris, Andreas
Long, Fan
author_facet Chen, Zhiyang
Beillahi, Sidi Mohamed
Barahimi, Pasha
Minwalla, Cyrus
Du, Han
Veneris, Andreas
Long, Fan
contents Smart contracts power decentralized financial (DeFi) services but are vulnerable to security exploits that can lead to significant financial losses. Existing security measures often fail to adequately protect these contracts due to the composability of DeFi protocols and the increasing sophistication of attacks. Through a large-scale empirical study of historical transactions from the 37 hacked DeFi protocols, we discovered that while benign transactions typically exhibit a limited number of unique control flows, in stark contrast, attack transactions consistently introduce novel, previously unobserved control flows. Building on these insights, we developed CrossGuard, a novel framework that enforces control flow integrity onchain to secure smart contracts. Crucially, CrossGuard does not require prior knowledge of specific hacks. Instead, configured only once at deployment, it enforces control flow whitelisting policies and applies simplification heuristics at runtime. This approach monitors and prevents potential attacks by reverting all transactions that do not adhere to the established control flow whitelisting rules. Our evaluation demonstrates that CrossGuard effectively blocks 35 of the 37 analyzed attacks when configured only once at contract deployment, maintaining a low false positive rate of 0.26% and minimal additional gas costs. These results underscore the efficacy of applying control flow integrity to smart contracts, significantly enhancing security beyond traditional methods and addressing the evolving threat landscape in the DeFi ecosystem.
format Preprint
id arxiv_https___arxiv_org_abs_2504_05509
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Enforcing Control Flow Integrity on DeFi Smart Contracts
Chen, Zhiyang
Beillahi, Sidi Mohamed
Barahimi, Pasha
Minwalla, Cyrus
Du, Han
Veneris, Andreas
Long, Fan
Cryptography and Security
Software Engineering
Smart contracts power decentralized financial (DeFi) services but are vulnerable to security exploits that can lead to significant financial losses. Existing security measures often fail to adequately protect these contracts due to the composability of DeFi protocols and the increasing sophistication of attacks. Through a large-scale empirical study of historical transactions from the 37 hacked DeFi protocols, we discovered that while benign transactions typically exhibit a limited number of unique control flows, in stark contrast, attack transactions consistently introduce novel, previously unobserved control flows. Building on these insights, we developed CrossGuard, a novel framework that enforces control flow integrity onchain to secure smart contracts. Crucially, CrossGuard does not require prior knowledge of specific hacks. Instead, configured only once at deployment, it enforces control flow whitelisting policies and applies simplification heuristics at runtime. This approach monitors and prevents potential attacks by reverting all transactions that do not adhere to the established control flow whitelisting rules. Our evaluation demonstrates that CrossGuard effectively blocks 35 of the 37 analyzed attacks when configured only once at contract deployment, maintaining a low false positive rate of 0.26% and minimal additional gas costs. These results underscore the efficacy of applying control flow integrity to smart contracts, significantly enhancing security beyond traditional methods and addressing the evolving threat landscape in the DeFi ecosystem.
title Enforcing Control Flow Integrity on DeFi Smart Contracts
topic Cryptography and Security
Software Engineering
url https://arxiv.org/abs/2504.05509