GoGoPool contest - 0xLad's results

Liquid staking for Avalanche.

General Information

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

GoGoPool

Findings Distribution

Researcher Performance

Rank: 102/111

Findings: 1

Award: $14.91

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

14.9051 USDC - $14.91

Labels

bug
3 (High Risk)
satisfactory
duplicate-209

External Links

Lines of code

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

Vulnerability details

Impact

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.

Proof of Concept

  1. The first user (Alice) deposits 1 wei of assets and receives 1 wei of shares.
  2. The second user (Bob) sends a tx to deposit 100e18 assets into the vault, and expects to receive 100e18 of shares because the asset:share ratio is 1:1.
  3. Alice frontruns Bob and donates 51e18 - 1 assets to the vault. After Bob's transaction completes, he receives (100e18) * (1 / 51e18 ) = 1 wei of shares.

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

AuditHub

A portfolio for auditors, a security profile for protocols, a hub for web3 security.

Built bymalatrax © 2024

Auditors

Browse

Contests

Browse

Get in touch

ContactTwitter