The sun reseed lacks the migration of the s.sys.season.start
state variable. That could lead to executing several seasons in the same transaction and bypassing some flashloan protections
The migration of the sun state is executed as follows:
We can see that only the current season number, the period, the timestamp and the temperature will be set during initialization. However, here lacks a really important state variable, the s.sys.season.start
. This variable is used to check if enough time elapsed to call a new sunrise
function. The function that checks it is the following:
Let's take a real example with data that could happen in a real case. At the time of writing this report the L1 beanstalk contract has the following state variables corresponding to the sun:
Imagine that the current timestamp is 1720360820. In this specific moment and with this data it would not be possible to call a sunrise
function in the L1 because:
And 22896 is not greater than s.sys.season.current
which is 22896. However, let's now evaluate if it would be possible to call the sunrise
function on L2 when the reseed function would be called and s.sys.season.start
would not be set:
That means that the sunrise function would be executable until reaching this season number. This is also possible because each sunrise
function only advances a single season number regardless of the time elapsed and the condition above would still be true until reaching the season number 477878:
This can be really dangerous because there might be some components of the protocol that rely on the season number. For example, when depositing into the silo, there is some stalk that needs to be germinated during 2 seasons, that could be exploited by somebody that takes a flashloan with a big amount of a token, deposits it, advances 2 seasons because of this issue, and he would have at the same transaction the stalk proportional to his huge deposit. All of this in a single transaction.
High, this issue can open some high risk exploits for the system
Manual review
Add the migration of the s.sys.season.start
state variable from the L1:
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.