You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgrade each function in Beanstalk that changes state to check that the Beanstalk contract does not take on bad debt as a result of the function execution.
Problem
Since Replant in August 2022, there have been 5 bugs that could have led to a loss of funds (fixed in EBIPs 1, 4, 5 (only Circulating assets were at risk), 10 and 12). In particular, the bugs that were mitigated in EBIPs 1, 10 and 12 could have led to losses of nearly all value in the Beanstalk contract.
Since the creation of the Immunefi Bug Bounty Program in BIP-26, the DAO has paid 1,552,385 Beans in bounties, 1,322,100 of which was for bug reports concerning funds in the Beanstalk contract that were at risk.
Solution
Define an invariant condition such that for every ERC-20 token, the number of tokens in the Beanstalk contract is equal to the sum of the balances in each different state that the asset can be in within Beanstalk as tracked by storage variables (i.e., the Silo, Farm balances, Pod Orders, Harvestable Pods, Rinsable Sprouts, Ripe assets, Legacy Withdrawals, etc.).
Upgrade each function in Beanstalk that changes state to check that this invariant condition is not broken as a result of the function execution.
Context
One of the general development philosophies of Beanstalk up to this point has been to optimize gas costs due to the high costs of transacting on Ethereum. Although this upgrade will increase the gas costs of interacting with Beanstalk, this seems like a worthwhile change in light of the recent reported vulnerabilities that could have caused significant harm to Beanstalk.
Upon exploiting any of the vulnerabilities associated with EBIPs 1, 4, 10 and 12, the Beanstalk contract would have taken on bad debt, i.e., its outstanding liabilites (as tracked in storage) would have been greater than its assets (actual tokens in the contract).
This upgrade would prevent Beanstalk from ever taking on any bad debt. Checking this condition in every Beanstalk function that changes state will cost gas to the function caller.
Specification
TBD.
The text was updated successfully, but these errors were encountered:
RFC: Secure Beanstalk
Authors
Brean, Brendan Sanderson, Guy, Ben Weintraub
Summary
Upgrade each function in Beanstalk that changes state to check that the Beanstalk contract does not take on bad debt as a result of the function execution.
Problem
Since Replant in August 2022, there have been 5 bugs that could have led to a loss of funds (fixed in EBIPs 1, 4, 5 (only Circulating assets were at risk), 10 and 12). In particular, the bugs that were mitigated in EBIPs 1, 10 and 12 could have led to losses of nearly all value in the Beanstalk contract.
Since the creation of the Immunefi Bug Bounty Program in BIP-26, the DAO has paid 1,552,385 Beans in bounties, 1,322,100 of which was for bug reports concerning funds in the Beanstalk contract that were at risk.
Solution
Define an invariant condition such that for every ERC-20 token, the number of tokens in the Beanstalk contract is equal to the sum of the balances in each different state that the asset can be in within Beanstalk as tracked by storage variables (i.e., the Silo, Farm balances, Pod Orders, Harvestable Pods, Rinsable Sprouts, Ripe assets, Legacy Withdrawals, etc.).
Upgrade each function in Beanstalk that changes state to check that this invariant condition is not broken as a result of the function execution.
Context
One of the general development philosophies of Beanstalk up to this point has been to optimize gas costs due to the high costs of transacting on Ethereum. Although this upgrade will increase the gas costs of interacting with Beanstalk, this seems like a worthwhile change in light of the recent reported vulnerabilities that could have caused significant harm to Beanstalk.
Upon exploiting any of the vulnerabilities associated with EBIPs 1, 4, 10 and 12, the Beanstalk contract would have taken on bad debt, i.e., its outstanding liabilites (as tracked in storage) would have been greater than its assets (actual tokens in the contract).
This upgrade would prevent Beanstalk from ever taking on any bad debt. Checking this condition in every Beanstalk function that changes state will cost gas to the function caller.
Specification
TBD.
The text was updated successfully, but these errors were encountered: