Lack of SAFEAPPROVE(o) in the INITIALIZER which can only be can only be called once #6
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
disagree with severity
Sponsor confirms validity, but disagrees with warden’s risk assessment (sponsor explain in comments)
invalid
This doesn't seem right
Lines of code
https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashBase.sol#:~:text=assetToken.safeApprove(address(NotionalV2)%2C%20type(uint256).max)%3B
https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashBase.sol#:~:text=underlyingToken.safeApprove(address(NotionalV2)%2C%20type(uint256).max)%3B
Vulnerability details
Impact
The users won't be able to go back to
initialize
for that specific fCash asset once thesafeApprove
reverts because thesafeApprove()
has a non-zero value.Proof of Concept
https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashBase.sol#:~:text=assetToken.safeApprove(address(NotionalV2)%2C%20type(uint256).max)%3B
https://github.com/code-423n4/2022-06-notional-coop/blob/main/notional-wrapped-fcash/contracts/wfCashBase.sol#:~:text=underlyingToken.safeApprove(address(NotionalV2)%2C%20type(uint256).max)%3B
When using deprecated function it could leas to unintended reverts and since its the initializer function you get locked out and can't call it again. More understanding about this issue could be link here: OpenZeppelin/openzeppelin-contracts#2219
Tools Used
Manuel Review
Recommended Mitigation Steps
Approve with a zero amount first before setting the actual amount. Consider use safeIncreaseAllowance and safeDecreaseAllowance.
The text was updated successfully, but these errors were encountered: