-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Buyout module] Fraction price is not updated when total supply changes #337
Comments
Duplicate of #148 |
This is a valid suggestion to consider, improving robustness for future modules. Lowering risk and merging with the warden's QA report #524 |
Reading Fractional's docs, it seems that they intend the vaults to use not only their modules, but also from other sources as long as they're trusted:
An innocent user or an attacker can be creating a split module, even getting it reviewed or audited and then creating a vault with it. |
Fair point. I'll reset this to Medium. Thanks |
Just to add, we're not certifying that the Buyout is safe in every context that it could be used in. In that statement we were trying to indicate that you can add modules outside of our curated set, but you would need to be aware of the trust assumptions with regards to both the individual module as well as their composition with others ie rapid inflationary mechanisms and a buyout. I recognize that we could have better handled the case of fraction supply changes during a buyout but inflation was outside of our initial scope for our curated launch. Thank you for reviewing our protocol and providing feedback it's greatly appreciated 🙏 |
Hi Scope:I don't think it's fair towards wardens to exclude whatever wasn't explicitly excluded in the contest description that was given at the beginning of the contest (I don't mean to explicitly address that specific issue, but to have the exclusion clearly inferred from the given contest description). Responsibility:While sponsors input and the way they view the platform is important, I think what matters the most is the way the users would view it with the given docs and the trust they'll loose in the platform in case of an attack. Severity:I'm not sure if C4 is going by OWASP severity assessment model (last reports do mention it, the docs repo does too but the docs website doesn't seem to mention it), but it seems like it's going along the lines of it. |
Lines of code
Lines: https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Buyout.sol#L118-L138
https://github.com/code-423n4/2022-07-fractional/blob/8f2697ae727c60c93ea47276f8fa128369abfe51/src/modules/Buyout.sol#L156-L165
Vulnerability details
In the buyout module when a buyout starts - the module stores the
fractionPrice
, and when a user wants to buy/sell fractions thefractionPrice
is loaded from storage and based on that the module determines the price of the fractions.The issue here is that the total supply might change between the time the buyout start till the buy/sell time, and the
fractionPrice
stored in the module might not represent the real price anymore.Currently there are no module that mint/burn supply at the time of buyout, but considering that Fractional is an extendible platform - Fractional might add one or a user might create his own module and create a vault with it.
An example of an innocent module that can change the total supply - a split module, this hypothetical module may allow splitting a coin (multiplying the balance of all users by some factor, based on a vote by the holders, the same way QuickSwap did at March)).
If that module is used in the middle of the buyout, that fraction price would still be based on the old supply.
Impact
Proof of Concept
Consider the following scenario
Here's a test (added to the
test/Buyout.t.sol
file) demonstrating this scenario (test passes = the bug exists).Trying to create a proof for minting was too much time-consuming, so I just disabled the proof check in
Vault.execute
in order to simulate the split:Tools Used
Foundry
Recommended Mitigation Steps
Calculate fraction price at the time of buy/sell according to the current total supply:
(Disclosure: this is based on a solution I made for a different bug)
The text was updated successfully, but these errors were encountered: