Juicebox V2 contest - GalloDaSballo's results

The decentralized fundraising and treasury protocol.

General Information

Platform: Code4rena

Start Date: 01/07/2022

Pot Size: $75,000 USDC

Total HM: 17

Participants: 105

Period: 7 days

Judge: Jack the Pug

Total Solo HM: 5

Id: 143

League: ETH

Juicebox

Findings Distribution

Researcher Performance

Rank: 22/105

Findings: 2

Award: $577.55

🌟 Selected for report: 0

🚀 Solo Findings: 0

Awards

14.8726 USDC - $14.87

Labels

bug
duplicate
3 (High Risk)
valid

External Links

Lines of code

https://github.com/jbx-protocol/juice-contracts-v2-code4rena/blob/828bf2f3e719873daa08081cfa0d0a6deaa5ace5/contracts/JBChainlinkV3PriceFeed.sol#L42-L43

Vulnerability details

Price Feed is not checked for freshness

In times of network conjestion, the priceFeed may take longer than expected to update, and the price may take longer than usual to update, in order to ensure the latest price is fresh (within update window), you should verify that the feed was updated recently enough

https://github.com/jbx-protocol/juice-contracts-v2-code4rena/blob/828bf2f3e719873daa08081cfa0d0a6deaa5ace5/contracts/JBChainlinkV3PriceFeed.sol#L42-L43

Here's an example of how to ensure the price was updated recently enough

// Check Price ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ) = feed.latestRoundData(); require(block.timestamp - updatedAt < SECONDS_PER_HOUR); // Check for freshness of feed

#0 - drgorillamd

2022-07-12T19:21:01Z

Duplicate of #138

Findings Information

🌟 Selected for report: bardamu

Also found by: GalloDaSballo, berndartmueller, codexploder, horsefacts

Labels

bug
duplicate
2 (Med Risk)
sponsor disputed
valid

Awards

562.6794 USDC - $562.68

External Links

Lines of code

https://github.com/jbx-protocol/juice-contracts-v2-code4rena/blob/828bf2f3e719873daa08081cfa0d0a6deaa5ace5/contracts/JBPrices.sol#L115

Vulnerability details

Price Feed may get retired, updated, changed

It may be best to let the price feed be changeable as a new price feed with different update rate or threshold may be introduced in the future, however the code will not allow changing of priceFeeds.

https://github.com/jbx-protocol/juice-contracts-v2-code4rena/blob/828bf2f3e719873daa08081cfa0d0a6deaa5ace5/contracts/JBPrices.sol#L115

    if (feedFor[_currency][_base] != IJBPriceFeed(address(0))) revert PRICE_FEED_ALREADY_EXISTS();

Price feeds may also be deprecated and reintroduced with new addresses, because the function is limited by the onlyOwner it may be best to allow overwriting of the price, or setting up a new function that would enable replacing or removing a deprecated price feed.

Remediation Steps

Allow the owner to set a new price feed

#0 - mejango

2022-07-12T20:05:35Z

new price feeds with updated oracles can be added and used by projects in the future.

#1 - jack-the-pug

2022-07-31T12:22:23Z

Duplicate of #59

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