Report ID
#13942
Target
https://etherscan.io/address/0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5
Report type
Smart Contract
Impacts
Griefing (e.g. no profit motive for an attacker, but damage to the users or the protocol)
Has PoC?
Yes
Bug Description
The excessive calling of function enrootDeposit seems to be unnecessary if I understand the logic of the SiloFacet.sol and the enrootDeposit function proberly.
Allowance of excessive iteration causes following documented attack vectors:
CWE-834: Excessive Iteration and possibly
CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Following the logic definition of enroot:
"Enroot- Adds Revitalized Stalk and Seeds to your Stalk and Seed balances, respectively. Revitalized Stalk - Stalk that have vested for pre-exploit Silo Members. Revitalized Stalk are minted as the percentage of Fertilizer sold increases. Revitalized Stalk does not contribute to Stalk ownership until Enrooted.
Revitalized Assets- Upon Replant, Silo Members in the block prior to the exploit received a portion of their Stalk and Seeds based on the percentage of Fertilizer sold prior to Replant. As the percentage of Fertilizer sold increases, additional Stalk and Seeds become Revitalized and can be Enrooted. Revitalized Stalk and Seeds start earning Bean seigniorage and Grown Stalk, respectively, upon being Enrooted." source https://docs.bean.money/guides
If I understand the above right enroot for direct deposits can only be done once per season to add revitalized stalk and seed to balances. There is no explanation why it should be called multiple times for same args, or rather does not make sense. Unless, enroot can be called with same args multiple times for stalk ownership
Impact
"If the iteration can be influenced by an attacker, this weakness could allow attackers to consume excessive resources such as CPU or memory. In many cases, a loop does not need to be infinite in order to cause enough resource consumption to adversely affect the software or its host system; it depends on the amount of resources consumed per iteration." - CWE-834: Excessive Iteration
Risk Breakdown
Difficulty to Exploit: Easy
Recommendation
Calling enrootDeposit, excessively does not add any value to the overall logic i.e. using (same arguments) after first call since per the logic of the program the enrootDeposit can only be done once to revitalized seed and stalk.
Or alternatively function Deposit() using External mode functionality should be removed since no one has used it after the exploit (please check diamond on chain activity)
References
https://cwe.mitre.org/data/definitions/834.html https://cwe.mitre.org/data/definitions/835.html https://arxiv.org/pdf/2107.11598.pdf https://help.nintex.com/en-us/nintex2010/help/workflow/RootCategory/Configuration/Nintex.Workflow.PreventingExcessiveLooping.htm
NB: Like I said, for a skilled hacker this is a valid entry point to cause infinite loop or undesired behavior. Stand to be corrected
Proof of concept