A Language for Smart Contracts with Secure Control Flow (Technical Report)
Siqiu Yao, Haobin Ni, Stephanie Ma, Noah Schiff, Andrew C. Myers, Ethan Cecchetti
TL;DR
SCIF addresses the risk of control-flow attacks in open multi-contract ecosystems by introducing an information-flow based smart contract language that enforces both data integrity and secure control flow. It extends traditional IFC with explicit endorsements, dynamic trust checks, reentrancy locks, and distinct exception semantics, and targets secure compilation to Solidity. The approach demonstrates CDA safety, robust reentrancy protection, and explicit error handling through a formal Core SCIF model, a complete implementation, and extensive case studies across real-world vulnerable contracts, with modest runtime overhead. This work offers a principled, scalable foundation for secure multi-contract programming in decentralized environments and suggests avenues for extending IFC-based security to broader software contexts.
Abstract
Smart contracts are frequently vulnerable to control-flow attacks based on confused deputies, reentrancy, and incorrect error handling. These attacks exploit the complexity of interactions among multiple possibly unknown contracts. Existing best practices to prevent vulnerabilities rely on code patterns and heuristics that produce both false positives and false negatives. Even with extensive audits and heuristic tools, new vulnerabilities continue to arise, routinely costing tens of millions of dollars. We introduce SCIF, a language for secure smart contracts, that addresses these classes of control-flow attacks. By extending secure information flow mechanisms in a principled way, SCIF enforces both classic end-to-end information flow security and new security restrictions on control flow, even when SCIF contracts interact with malicious non-SCIF code. SCIF is implemented as a compiler to Solidity. We show how SCIF can secure contracts with minimal overhead through case studies of applications with intricate security reasoning and a large corpus of insecure code.
