It shouldn’t be possible to create a vault with Cally’ own token #224
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)
resolved
Finding has been patched by sponsor (sponsor pls link to PR containing fix)
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/main/contracts/src/Cally.sol#L193
https://github.com/code-423n4/2022-05-cally/blob/main/contracts/src/Cally.sol#L199
Vulnerability details
Impact
Affected code:
Currently it’s possible to create an ERC-721 vault using Cally’ own address as
token
, and using the freshly minted vault id astokenIdOrAmount
. This results in a new vault whose ownership is passed to Cally contract immediately upon creation.The vault allows users to perform
buyOption
and increase the ETH balance of the Cally contract itself, which is still the vault beneficiary. As soon as an user callsexercise
, she will receive thevault.tokenIdOrAmount
in exchange, which in this case coincides with the vault nft. However this is of no good because the final user may just initiate a withdrawal, which will:So the vault will be unusable and the ETH deposited by users to buy/exercise options will remain locked in Cally contract
Proof of Concept
token
and13
astokenIdOrAmount
createVault()
mints the vault token to the user, and then transfers the underlying address from the user, an user is able to create a vault with something she doesn’t own at the moment of thecreateVault()
function call, because it’s created while the function runs13
is pretty limited in functionality, because Cally’ smart contract is the ownerexercise
the active option, becomes the vault owner now; this is of no good because no one can actually callwithdraw()
as it will always revert, and no one can recover the ETH deposited by Alice and Bob as they are locked foreverTools Used
Editor
Recommended Mitigation Steps
Add the following check at the start of
createVault()
:The text was updated successfully, but these errors were encountered: