The UnripeFacet contract implements the ReentrancyGuard as a shield against reentrancy. All its external/public functions such as addMigratedUnderlying(), addUnripeToken(), pick() & chop() which involve state changes and at the same time interact with other functions from other contracts are protected by nonReentrant modifier.
However, the switchUnderlyingToken() function is missing this modifier when it just as all the other functions operate in a similar manner.
https://github.com/Cyfrin/2024-04-beanstalk-2/blob/a3d702c2e108cac6ebdf2416906cbca73c83ec99/protocol/contracts/beanstalk/barn/UnripeFacet.sol#L343-L350
This function makes an external call to LibUnripe.switchUnderlyingToken():
which modifies the underlyingToken attribute of the u mapping entry associated with the unripeToken provided as an argument.
By assigning newUnderlyingToken to s.u[unripeToken].underlyingToken, the function updates the underlying token associated with the unripeToken.
Since the switchUnderlyingToken() function modifies contract state and involves external calls without proper reentrancy protection, it may be susceptible to reentrancy attacks.
Manual Review
It is in order for this function to have the nonReentrant modifier as the other functions have it as well..
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.