Can send too much ETH in the buyOption
function
#263
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
Cally.sol#L224
Vulnerability details
Impact
When buying an option, the
msg.value
of the call to the buyOption function may be larger than the actual value of the premium.This could lead to users accidently sending more than the cost of the premium and losing the extra ETH.
Proof of Concept
buyOption
for a vault with a 0.1 ETH premium.msg.value
for the call to 1 ETH.Recommended Mitigation Steps
Consider setting the condition on line 224 to
require(msg.value == premium, "Incorrect ETH amount sent")
.The text was updated successfully, but these errors were encountered: