The bug arise from the manipulation of oracle data used in the contract, the functions
rewardToFertilizer
and setSoilBelowPeg
rely on the deltaB
value, which can be manipulated through the oracle, and this manipulation can lead to incorrect calculations for fertilizer rewards and soil adjustments, causing significant market imbalances
The contract relies on oracle data to adjust soil issuance and distribute Beans, so Manipulation of this oracle data can lead to incorrect adjustments and distributions, causing market imbalances such as over-issuance or under-issuance of Beans and this can affect the value of Beans and overall market stability here is the vulnerable lines :
In rewardToFertilizer
Function:
Here it’s calculates the maximum new Beans that can be fertilized. If the amount is manipulated via oracle data, this calculation will be incorrect.
here the Calculation of newBpf
on the maxNewFertilized value. Any incorrect calculation will propagate here, affecting the Beans per Fertilizer.
And this loop is relies on the value derived from oracle data.
in the setSoilBelowPeg
Function:
Here the Calculation of instDeltaB
and here is the usage of Oracle Data in LibWellMinting Library :
https://github.com/Cyfrin/2024-05-Beanstalk-3/blob/662d26f12ee219ee92dc485c06e01a4cb5ee8dfb/protocol/contracts/libraries/Minting/LibWellMinting.sol#L231
Incorrect adjustments to Soil and Bean minting can lead to market imbalances
Manual review
Need to add validation and multiple data sources for the oracle data to mitigate the risk of manipulation
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.