The disastrous vulnerabilities in smart contracts sharply remind us of our ignorance: we do not know how to write code that is secure in composition with malicious code. Information flow control has long been proposed as a way to achieve compositional security, offering strong guarantees even when combining software from different trust domains. Unfortunately, this appealing story breaks down in the presence of reentrancy attacks. We formalize a general definition of reentrancy and introduce a security condition that allows software modules like smart contracts to protect their key invariants while retaining the expressive power of safe forms of reentrancy. We present a security type system that provably enforces secure information flow; in conjunction with run-time mechanisms, it enforces secure reentrancy even in the presence of unknown code; and it helps locate and correct recent high-profile vulnerabilities.
翻译:智能合同中的灾难性脆弱性使我们清楚地认识到我们的无知:我们不知道如何写出以恶意代码构成的安全代码;信息流通控制长期以来一直被提议作为实现组成安全的一种方法,即使将不同信任领域的软件结合起来,也提供了强有力的保障;不幸的是,这一令人兴奋的故事在出现回旋攻击时就破灭了;我们正式确定了再现的一般性定义,并引入了一种安全条件,允许智能合同等软件模块保护其关键变量,同时保留了安全再现形式的明示力量;我们提出了一个安全类型系统,可以确保信息流动的安全;与运行机制相结合,即使存在未知代码,它也能实施安全再现;它有助于查找和纠正最近出现的高知名度弱点。