Lack of nonReentrant
modifier in yield source contracts
#119
Labels
1 (Low Risk)
ATokenYieldSource
BadgerYieldSource
bug
Something isn't working
IdleYieldSource
sponsor confirmed
SushiYieldSource
Handle
shw
Vulnerability details
Impact
The
YearnV2YieldSource
contract prevents thesupplyTokenTo
,redeemToken
, andsponsor
functions from being reentered by applying anonReentrant
modifier. Since these contracts share a similar logic, adding anonReentrant
modifier to these functions in all of the yield source contracts is reasonable. However, the same protection is not seen in other yield source contracts.Proof of Concept
A
nonReentrant
modifier in the following functions is missing:sponsor
function ofATokenYieldSource
supplyTokenTo
andredeemToken
function ofBadgerYieldSource
sponsor
function ofIdleYieldSource
supplyTokenTo
andredeemToken
function ofSushiYieldSource
Referenced code:
ATokenYieldSource.sol#L233
BadgerYieldSource.sol#L43
BadgerYieldSource.sol#L57
IdleYieldSource.sol#L150
SushiYieldSource.sol#L47
SushiYieldSource.sol#L66
Recommended Mitigation Steps
Add a
nonReentrant
modifier to these functions. ForBadgerYieldSource
andSushiYieldSource
contracts, make them inherit from Openzeppelin'sReentrancyGuardUpgradeable
to use thenonReentrant
modifier.The text was updated successfully, but these errors were encountered: