Differential fuzz testing upgradeable smart contracts with Diffusc
Summary: Trail of Bits released Diffusc, a tool that combines Slither-based static analysis with Echidna differential fuzz testing to compare two implementations of an upgradeable smart contract before an upgrade goes on-chain. The tool was motivated by the March 28, 2023 SafeMoon exploit, in which an error introduced in an upgrade to the SFM token contract let an attacker burn tokens held in a liquidity pool and drain it of roughly $8.9 million in Binance Coin.
Why it matters: The same upgrade mechanism that let SafeMoon lose $8.9 million also produced Compound's roughly $40 million in erroneously distributed COMP tokens in 2021, and Diffusc's taint analysis cut the Comptroller functions needing tests from 69 to 38 and cToken functions from 78 to 16 - a reminder that an upgrade you approve is a code change your existing tests may never have compared against the prior version.
Read the original at Trail of Bits Blog ↗