Gro Protocol contest - shw's results

The first protocol to balance your exposure, tranche risk and boost yields all at once.

General Information

Platform: Code4rena

Start Date: 01/07/2021

Pot Size: $100,000 USDC

Total HM: 10

Participants: 7

Period: 7 days

Judge: ghoulsol

Total Solo HM: 4

Id: 17

League: ETH

Gro Protocol

Findings Distribution

Researcher Performance

Rank: 4/7

Findings: 5

Award: $18,939.00

🌟 Selected for report: 3

🚀 Solo Findings: 1

Findings Information

🌟 Selected for report: cmichel

Also found by: shw

Labels

bug
duplicate
3 (High Risk)

Awards

5885.9975 USDC - $5,886.00

External Links

Handle

shw

Vulnerability details

Impact

The safetyCheck function of Buoy3Pool checks the two ratios, a/b and a/c, to be healthy but not the ratio b/c. This ratio may be unhealthy, causing assets (USDC, USDT) to be exchanged at a not-so-good price.

Proof of Concept

Consider the following situation:

  1. lastRatio[1] and lastRatio[2] are both 1000000 (i.e., price of DAI == USDC == USDT).
  2. Now, the state of Curve 3pool is slightly imbalanced, with the price USDC > DAI > USDT. The ratio a/b is 998000, and the ratio a/c is 1002000.
  3. Both a/b and a/c are within tolerance (i.e., the difference between itself and its previous value does not exceeds BASIS_POINTS). However, the ratio b/c is not because it differs from the previous value by approximately 2 * BASIS_POINTS.

Referenced code: Buoy3Pool.sol#L87-L96

Check the ratio of b/c to ensure it is also healthy.

#0 - kitty-the-kat

2021-07-14T20:39:08Z

#104

#1 - ghoul-sol

2021-07-26T03:36:13Z

Duplicate of #104 so high risk.

Findings Information

🌟 Selected for report: gpersoon

Also found by: shw

Labels

bug
duplicate
3 (High Risk)

Awards

5885.9975 USDC - $5,886.00

External Links

Handle

shw

Vulnerability details

Impact

The sortVaultsByDelta function of Exposure does not properly initialize the maxIndex and minIndex variables. Consider an edge case where the delta of the three stable coins are all 0. The maxIndex and minIndex variables will be all 0 and vaultIndexes will be [0, 3, 0], which are invalid. The results of the users' deposits could be affected by this bug.

Proof of Concept

Referenced code: Exposure.sol#L178-L210

Initialize maxIndex and minIndex to 0 and 1 to handle this edge case while being correct in other cases.

#0 - kitty-the-kat

2021-07-14T20:58:45Z

#2

#1 - ghoul-sol

2021-07-26T14:38:12Z

int256 delta = int256( unifiedAssets[i] - unifiedTotalAssets.mul(targetPercents[i]).div(PERCENTAGE_DECIMAL_FACTOR) );

It seems that there's a mathematical possibility that assets will have an ideal proportion between vaults and delta might be 0.

Duplicate of #2 to high risk.

Findings Information

🌟 Selected for report: shw

Labels

bug
2 (Med Risk)
disagree with severity

Awards

3923.9983 USDC - $3,924.00

External Links

Handle

shw

Vulnerability details

Impact

According to Chainlink's documentation, the latestAnswer function is deprecated. This function does not error if no answer has been reached but returns 0, causing an incorrect price fed to the Buoy3Pool.

Proof of Concept

Referenced code: Buoy3Pool.sol#L207 Buoy3Pool.sol#L214-L216

Referenced documentation: Chainlink - Deprecated API Reference Chainlink - Migration Instructions Chainlink - API Reference

Use the latestRoundData function to get the price instead. Add checks on the return data with proper revert messages if the price is stale or the round is uncomplete, for example:

(uint80 roundID, int256 price, , uint256 timeStamp, uint80 answeredInRound) = oracle.latestRoundData();
require(answeredInRound >= roundID, "...");
require(timeStamp != 0, "...");

#0 - kitty-the-kat

2021-07-14T15:06:34Z

disagree with severity (Low risk) Issue would cause deposits and withdrawals to stop, no funds lost

#1 - ghoul-sol

2021-07-26T15:56:46Z

In my opinion halting the protocol deserves medium risk. While no funds are lost, from brand perspective it's a second worst thing. Keeping as medium risk.

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