GoGoPool contest - WatchDogs'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: 111/111

Findings: 1

Award: $3.73

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

3.7263 USDC - $3.73

Labels

bug
3 (High Risk)
partial-25
upgraded by judge
duplicate-209

External Links

Lines of code

https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L148

Vulnerability details

Impact

Using the previewRedeem function of ERC4626Upgradeable, it is possible to manipulate the price. An attacker can increase or decrease the price to carry out various attacks against the protocol.

Proof of Concept

The preview methods return values that are as close as possible to exact as possible. For that reason, they are manipulable by altering the on-chain conditions and are not always safe to be used as price oracles. This specification includes convert methods that are allowed to be inexact and therefore can be implemented as robust price oracles. For example, it would be correct to implement the convert methods as using a time-weighted average price in converting between assets and shares.`

The previewRedeem function will call the convertToAssets function, in the convertToAssets the share is calculated on the basis of totalAsset and supply which can be increased or decreased within a single transaction by calling the deposit functions, This allows the attacker to inflate or deflate the price within a single transaction.

https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L148

function previewRedeem(uint256 shares) public view virtual returns (uint256) { return convertToAssets(shares); }

https://github.com/code-423n4/2022-12-gogopool/blob/main/contracts/contract/tokens/upgradeable/ERC4626Upgradeable.sol#L126

function convertToAssets(uint256 shares) public view virtual returns (uint256) { uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero. return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply); }

Tools Used

Code inspection

Price in ERC4626 vault should not be calculated using previewReedem function.

#0 - GalloDaSballo

2023-01-03T23:14:21Z

In contrast to other reports, this is missing the specific attack, I think I'll award a % vs the full finding

#1 - c4-judge

2023-01-10T07:57:10Z

GalloDaSballo marked the issue as duplicate of #209

#2 - c4-judge

2023-01-10T07:57:20Z

GalloDaSballo marked the issue as partial-25

#3 - GalloDaSballo

2023-01-10T07:57:43Z

25% because:

  • Lacks POC (Reasonable way to perform the attack)
  • Misses the bigger impact

#4 - c4-judge

2023-01-29T18:38:59Z

GalloDaSballo changed the severity to 3 (High Risk)

#5 - c4-judge

2023-02-08T09:45:14Z

GalloDaSballo marked the issue as satisfactory

#6 - c4-judge

2023-02-08T09:45:27Z

GalloDaSballo marked the issue as partial-25

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