Using transferFrom
on ERC721 tokens
#236
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
duplicate
This issue or pull request already exists
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Lines of code
https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L295
Vulnerability details
Impact
When exercising an option with an underlying ERC721 token, the exerciser receives the ERC721 token via the unsafe
transferFrom
instead of the safe counterpartsafeTransferFrom
. If the exerciser is a contract and is not aware of incoming ERC721 tokens, the sent ERC721 tokens could be locked.safeTransferFrom
checks that contract recipients are aware of the ERC721 protocol to prevent tokens from being forever locked.Proof of Concept
Cally.sol#L295
Tools Used
Manual review
Recommended mitigation steps
Consider using
safeTransferFrom()
within theexercise(uint256 optionId)
function as well as in thewithdraw(uint256 vaultId)
(Cally.sol#L344) function.The text was updated successfully, but these errors were encountered: