Yield-Convex contest - defsec's results

Fixed-rate borrowing and lending on Ethereum

General Information

Platform: Code4rena

Start Date: 28/01/2022

Pot Size: $30,000 USDC

Total HM: 4

Participants: 22

Period: 3 days

Judge: GalloDaSballo

Total Solo HM: 2

Id: 80

League: ETH

Yield

Findings Distribution

Researcher Performance

Rank: 13/22

Findings: 2

Award: $99.33

🌟 Selected for report: 0

🚀 Solo Findings: 0

Findings Information

🌟 Selected for report: throttle

Also found by: 0x1f8b, TomFrenchBlockchain, WatchPug, cccz, defsec, hack3r-0m, hyh, kenzo, leastwood, sirhashalot, ye0lde

Labels

bug
duplicate
2 (Med Risk)

Awards

69.1238 USDC - $69.12

External Links

Handle

defsec

Vulnerability details

Impact

The _peek function in the contract Cvx3CrvOracle.sol fetches the asset price from a Chainlink aggregator using the latestRoundData function. However, there are no checks on timestamp, resulting in stale prices. The oracle wrapper calls out to a chainlink oracle receiving the latestRoundData(). It then checks freshness by verifying that the answer is indeed for the last known round.

Stale prices could put funds at risk. According to Chainlink's documentation, This function does not error if no answer has been reached but returns 0, causing an incorrect price fed to the PriceOracle. The external Chainlink oracle, which provides index price information to the system, introduces risk inherent to any dependency on third-party data sources. For example, the oracle could fall behind or otherwise fail to be maintained, resulting in outdated data being fed to the index price calculations of the AMM. Oracle reliance has historically resulted in crippled on-chain systems, and complications that lead to these outcomes can arise from things as simple as network congestion.

Proof of Concept

  1. Navigate to the following contract.

"https://github.com/code-423n4/2022-01-yield/blob/main/contracts/Cvx3CrvOracle.sol#L120"

Tools Used

Consider to add checks on the return data (Timestamp) with proper revert messages if the price is stale in the timestamp, for example:

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

#0 - devtooligan

2022-02-01T01:13:08Z

dup of #2

#1 - GalloDaSballo

2022-02-18T00:57:24Z

Duplicate of #136

Findings Information

🌟 Selected for report: 0x1f8b

Also found by: Funen, IllIllI, TomFrenchBlockchain, Tomio, WatchPug, defsec, throttle

Labels

bug
duplicate
G (Gas Optimization)

Awards

5.6804 USDC - $5.68

External Links

Handle

defsec

Vulnerability details

Impact

'immutable' greatly reduces gas costs. There are variables that do not change so they can be marked as immutable to greatly improve the gas costs.

Proof of Concept

  1. For instance : https://github.com/code-423n4/2022-01-yield/blob/e946f40239b33812e54fafc700eb2298df1a2579/contracts/ConvexStakingWrapper.sol#L42

Tools Used

Code Review

Mark variables as immutable.

#0 - devtooligan

2022-02-01T02:26:04Z

dup of #42

Findings Information

🌟 Selected for report: robee

Also found by: 0x1f8b, Dravee, Funen, IllIllI, defsec, throttle

Labels

bug
duplicate
G (Gas Optimization)

Awards

7.2132 USDC - $7.21

External Links

Handle

defsec

Vulnerability details

Impact

++i is more gas efficient than i++ in loops forwarding.

Proof of Concept

  1. Navigate to the following contracts.
https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexYieldWrapper.sol#L111

Tools Used

Code Review

It is recommend to use unchecked{++i} and change i declaration to uint256.

#0 - alcueca

2022-02-02T16:11:19Z

Duplicate of #14

Findings Information

🌟 Selected for report: Dravee

Also found by: IllIllI, defsec, robee

Labels

bug
duplicate
G (Gas Optimization)

Awards

17.3157 USDC - $17.32

External Links

Handle

defsec

Vulnerability details

Impact

!= 0 is a cheaper operation compared to > 0, when dealing with uint.

Proof of Concept

  1. Navigate to the following contracts.
https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexStakingWrapper.sol#L165 https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexStakingWrapper.sol#L182 https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexYieldWrapper.sol#L128 https://github.com/code-423n4/2022-01-yield/blob/main/contracts/ConvexYieldWrapper.sol#L142

Tools Used

Code Review

Use "!=0" instead of ">0" for the gas optimization.

#0 - alcueca

2022-02-02T16:18:38Z

Duplicate of #57

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