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

fee can change without the consent of users #422

Open
code423n4 opened this issue Jul 4, 2022 · 2 comments
Open

fee can change without the consent of users #422

code423n4 opened this issue Jul 4, 2022 · 2 comments
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 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")

Comments

@code423n4
Copy link
Contributor

Lines of code

https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L240
https://github.com/code-423n4/2022-06-putty/blob/3b6b844bc39e897bd0bbb69897f2deff12dc3893/contracts/src/PuttyV2.sol#L497

Vulnerability details

Impact

Fees are applied during withdraw, but can change between the time the order is filled and its terms are agreed upon and the withdrawal time, leading to a loss of the expected funds for the concerned users.

Proof of Concept

The scenario would be:

  • Alice and Bob agrees to fill an order at a time fees are 0.1%
  • During the duration of the option, fees are increased to 3%
  • At withdrawal they'll pay 3% of the strike, although they wouldn't have created the order in the first place with such fees

Recommended Mitigation Steps

Mitigation could be:

  • Store the fees in Order and verify that they are correct when the order is filled, so they are hardcoded in the struct
  • Add a timestamp: this wouldn't fully mitigate but would still be better than the current setup
  • Keep past fees and fee change timestamps in memory (for example in an array) to be able to retrieve the creation time fees at withdrawal
@outdoteth
Copy link
Collaborator

outdoteth commented Jul 8, 2022

Report: Admin can change fee at any time for existing orders

@outdoteth outdoteth added the sponsor confirmed Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity") label Jul 8, 2022
@outdoteth
Copy link
Collaborator

outdoteth commented Jul 15, 2022

PR with fix: outdoteth/putty-v2#4

@outdoteth outdoteth added the resolved Finding has been patched by sponsor (sponsor pls link to PR containing fix) label Jul 15, 2022
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 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")
Projects
None yet
Development

No branches or pull requests

2 participants