TL;DR
In 2024, OpenZeppelin's partnership with Compound Finance demonstrated the critical importance of establishing proactive security measures in a demanding industry like DeFi. Together, we prevented a potential $120,000 loss by identifying and correcting a critical proposal error before execution. Additionally, our team prevented a governance attack that aimed to misappropriate $24 million worth of COMP tokens by detecting unusual voting patterns and mobilizing community action. Through continuous audits, real-time monitoring with Defender, incident response collaboration, governance automation, and educational initiatives, OpenZeppelin significantly enhanced Compound's security infrastructure, protected substantial assets, and strengthened community trust.
Compound Introduction
Compound is a leading lending DeFi protocol with over $2.5 billion in collateral, that enables users to lend and borrow crypto assets without any intermediary. Users can supply assets to liquidity pools and earn interest, receiving cTokens that represent their balance and accrue interest over time. Borrowers can access liquidity by providing collateral, with loans being over-collateralized to manage risk. Compound’s design has garnered widespread recognition within the DeFi developer community, making it the second most forked protocol, with 139 active projects built on its V2 code.
Governance is decentralized and managed by COMP token holders, who can propose and vote on protocol changes. This community-driven model promotes transparency and ensures the protocol evolves through collective user decisions. However, it also introduces additional layers of risk, which OpenZeppelin has played a key role in addressing and managing.
Key Incidents in 2024
Preventing Financial Loss
In early 2024, OpenZeppelin's security team identified a critical error in a proposal that could have resulted in approximately $120,000 worth of COMP tokens being irretrievably stuck in a bridge contract. The proposal intended to call the depositERC20To function on the Optimism gateway to transfer 2,400 COMP tokens. The remoteToken parameter was incorrectly set to the COMP token address on Base instead of Optimism. Since the COMP token does not implement the OptimismMintableERC20 interface, the StandardBridge contract would not validate the token pair, and the transaction would proceed without failure. This misconfiguration would have caused the tokens to become permanently inaccessible.
OpenZeppelin's Solution:
Governance Attack Prevention
In July 2024, Compound faced a significant governance challenge with Proposal 289, which aimed to allocate $24 million worth of COMP tokens to a yield-bearing strategy under suspicious circumstances. Unusual voting patterns suggested potential manipulation and a risk of asset misappropriation. The proposal lacked transparency and posed a high risk to the protocol's integrity.
OpenZeppelin's Solution:
Ongoing Security Enhancements
Throughout 2024, OpenZeppelin continued to strengthen Compound's security infrastructure:
Audits
Monitoring
Incident Response
Governance Automation
Educational Initiatives
Results and Impact
OpenZeppelin's partnership with Compound has yielded significant benefits:
Conclusion
The events of 2024 highlight the challenging nature of DeFi security vulnerabilities and the importance of a proactive security approach. OpenZeppelin's partnership with Compound continues to evolve, focusing on implementing security measures that cover the entire lifecycle of protocol development and operation. By combining deep technical expertise with real-time monitoring and community engagement, we're proud to help building a more secure and resilient DeFi ecosystem.