-
Notifications
You must be signed in to change notification settings - Fork 1
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
Inflation attack #58
Comments
I'm not sure if I follow as to how this is an inflation attack? We increase the price of each I also understand what you mean by front-running user deposits, but |
0xleastwood marked the issue as primary issue |
#35 refers to the correct instance of such an inflation attack. I'm not sure if this is consistent with that in anyway. |
0xleastwood marked the issue as unsatisfactory: |
Maybe some clarification of what the inflation attack is fundamentally about is warranted. The so-called inflation attack is usually conceived of as stealing the entire first deposit by front-running with a tiny deposit and balance donation. That is just one way to exploit this vulnerability, but the essence of the inflation attack is an inflation of the rounding errors. The usual exploit is the rounding of <1 to 0, which implies a 100 % loss of the deposit. But rounding e.g. <5 down to 4 implies a loss of 20 %, which is still significant.
It is in the numerator in
#35 is about an inflation attack in VotiumStrategy. This is only an issue insofar it affects AfEth. No guarantees are made with regards to interacting with VotiumStrategy directly; depositing there might as well be like sending funds to the zero-address. As for how much afEth is minted it doesn't matter whether we donate to AfEth's votium balance, or VotiumStrategy's CVX balance; both balances are factors in the Let's say we mitigate against inflation by making a pre-deposit. Then mitigating #35, i.e. pre-depositing into VotiumStrategy, does not mitigate #58, but pre-depositing into AfEth mitigates both. |
I understand where you are coming from but I think there is a lot of context missing in this issue. The attacker incurs rounding on their mint amount but those fewer minted tokens are still worth more tokens from the perspective of the user so is there really any loss? The attacker ultimately loses a significant amount by transferring into the contract. |
@0xleastwood Yes, there is a loss. The price is irrelevant; this is a rounding error issue. Any rounding loss must go somewhere, so it goes to the inflator, since he inflated the price after he got his shares. What would the user put as
#35 and #26 describe inflation of the VotiumStrategy price. The immediate impact of this is loss for those who deposit there. This impact is not much of an issue, since users are not supposed to deposit there. This is the same reason why you judged #33 as QA. |
I think this is extremely hypothetical and you are cherrypicking numbers to support your case. But I do understand the issue with rounding and I think donation style attacks should always be avoided even if not directly exploitable. Moving to QA. |
0xleastwood removed the grade |
0xleastwood changed the severity to QA (Quality Assurance) |
Also, you incorrectly assume the inflator benefits fully, unless they have complete control of the token supply before new deposits into the strategy, the rounded tokens are distributed to all existing token holders. So you're detailing an economic attack which requires significant capital (likely not even feasibly possible considering the total supply of ethereum) and an incorrectly configured |
This is not more hypothetical than #35. The attack here involves, just like #35, an initial deposit, immediately followed by a donation of assets. They are based on exactly the same assumptions.
Not at all. The attacker is in complete control of how much to inflate the price. If executed as a front-running attack he can match the victims
Again, he does have complete control of the supply since he it the first depositor, just like he must be in #35. |
Again, you are still cherrypicking numbers. Convex has a total token supply of |
Basically the amount of rounding would be in the order of |
This previously downgraded issue has been upgraded by 0xleastwood |
0xleastwood marked the issue as duplicate of #35 |
I did not mean to upgrade this, it looks like it was previously linked to #35. |
0xleastwood marked the issue as not a duplicate |
0xleastwood changed the severity to QA (Quality Assurance) |
The supply and decimals of Convex are irrelevant. The inflation and rounding is in AfEth. The AfEth supply is initially 0. It's just a standard inflation attack. Maybe you are confused by focussing on #35 speaking about VotiumStrategy and a missing |
Now you are just moving the goal post to support your case. Post-judging QA is for adding additional context and this was clearly not outlined or even mentioned in your original issue. I don't believe this was the intention of the original issue and I also believe |
This issue will remain as QA. |
What do you mean? This is exactly what I wrote in my Proof of Concept.
Which of the attacks? |
elmutt (sponsor) confirmed |
So we agree it is not similar to #35 in the sense that you can't perform the same front-running deposit attack because I just can't see how this attack would be possible and I think you are creating very specific scenarios to support your case that aren't necessarily true. I need you to stop comparing this to other issues because I have already stated my reasons for this in #35 and #33. |
#58 and #35 have the same impact (inflation of AfEth price) by different means. #35 also has another impact (inflation of VotiumStrategy price) which per #33 is not H/M.
|
we believe this will solve it: |
Lines of code
https://github.com/code-423n4/2023-09-asymmetry/blob/6b4867491350f8327d0ac4f496f263642cf3c1be/contracts/AfEth.sol#L140
Vulnerability details
Impact
AfEth.price()
can be inflated, causing severe rounding errors or constraints for subsequent deposits.Proof of Concept
(1) An initial depositor can
deposit()
ETH for an arbitrarily small amount of afEth, e.g. 1 afEth.(2) Both safEth and vAfEth can be staked and deposited into directly, so by obtaining these directly by himself outside of an AfEth deposit he can then
(3) inflate the
price()
by transferring a large amount of safEth and/or vAfEth (Votium strategy tokens), e.g. 1e18 Wei's worth, directly to the AfEth contract.price()
is calculated as the value in ETH of AfEth's balances of safEth and vAfEth per total supply of afEth; in this example 1e18 Wei/afEth. That is, the next depositor will receive only 1 afEth per whole ETH deposited, any remaining fraction being lost to rounding.deposit()
has a parameter_minout
which protects the next depositor against the usual frontrunning inflation attack where the victim unexpectedly suffers a rounding loss. But once the inflation attack has been performed the subsequent depositors will either suffer severe rounding losses or be constrained to deposit in highly granular amounts. Effectively, afEth will have less decimals (or none or negative) and be practically useless.Recommended Mitigation Steps
Any of the above (1) - (3) has to remedied. (2) may be a desirable feature and should probably remain.
(1) is remedied by making sure that the total supply be either 0 or greater than some sufficiently large amount (e.g. 1e9). One possibility is by simply making an initial deposit oneself.
(3) can be remedied by accounting only the safEth and vAfEth obtained by the contract via the proper pathway of
deposit()
. This renders any direct transfers to the contract invisible to it.Assessed type
ERC4626
The text was updated successfully, but these errors were encountered: