Platform: Code4rena
Start Date: 15/12/2022
Pot Size: $128,000 USDC
Total HM: 28
Participants: 111
Period: 19 days
Judge: GalloDaSballo
Total Solo HM: 1
Id: 194
League: ETH
Rank: 102/111
Findings: 1
Award: $14.91
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: 0xdeadbeef0x
Also found by: 0xLad, 0xNazgul, 0xSmartContract, 0xbepresent, Arbor-Finance, Breeje, HE1M, IllIllI, Qeew, Rolezn, SEVEN, SamGMK, SmartSek, TomJ, WatchDogs, ak1, btk, ck, datapunk, dic0de, eierina, fs0c, hansfriese, koxuan, ladboy233, peanuts, rvierdiiev, sces60107, tonisives, unforgiven, yongskiws
14.9051 USDC - $14.91
https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L42-L54 https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L56-L67
The user who deposits first can perform a "donation" attack on the user who deposits afterwards. The second user expects to get D
shares for a deposit of D
assets, but will get significantly less than D
shares.
The issue is present in the deposit()
and mint()
functions of the ERC4626Upgradeable
contract that TokenggAVAX
inherits from.
Bob deposited 66.2% (100 / 151) of the assets in the vault, but is only entitled to 50% (both he and Alice have 1 wei of shares). Bob can only withdraw 75.5e18 assets and has lost 25% of his deposit.
Add a minimum size for the first deposit, or add "virtual" assets and shares when doing asset-share conversions. See YieldBox for an example of the virtual asset approach.
#0 - c4-judge
2023-01-10T07:55:23Z
GalloDaSballo marked the issue as duplicate of #209
#1 - c4-judge
2023-02-08T09:45:12Z
GalloDaSballo marked the issue as satisfactory