Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option buys do not refund or reject over-payments #51

Closed
code423n4 opened this issue May 11, 2022 · 1 comment
Closed

Option buys do not refund or reject over-payments #51

code423n4 opened this issue May 11, 2022 · 1 comment
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")

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L224

Vulnerability details

Impact

Buyers are over-charged if they send too much in order to try to make the payment not revert due to the dutch auction's price decrease schedule

Proof of Concept

The buyOption() function uses >= rather than ==, and does not refund excess:

File: contracts/src/Cally.sol   #X

224           require(msg.value >= premium, "Incorrect ETH amount sent");

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L224

Incorrect amounts are rejected when payments are made for exercises, so at the very least things are inconsistent:

File: contracts/src/Cally.sol   #X

271           // check correct ETH amount was sent to pay the strike
272           require(msg.value == vault.currentStrike, "Incorrect ETH sent for strike");

https://github.com/code-423n4/2022-05-cally/blob/1849f9ee12434038aa80753266ce6a2f2b082c59/contracts/src/Cally.sol#L271-L272

Tools Used

Code inspection

Recommended Mitigation Steps

Reject amounts over the actual price, or refund the excess

@code423n4 code423n4 added 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 labels May 11, 2022
code423n4 added a commit that referenced this issue May 11, 2022
@outdoteth outdoteth added sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") duplicate This issue or pull request already exists labels May 15, 2022
@outdoteth
Copy link
Collaborator

#84

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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")
Projects
None yet
Development

No branches or pull requests

2 participants