Phuture Finance contest - csanuragjain's results

Crypto index platform, that simplifies your investments through automated, themed index products.

General Information

Platform: Code4rena

Start Date: 19/04/2022

Pot Size: $30,000 USDC

Total HM: 10

Participants: 43

Period: 3 days

Judges: moose-code, JasoonS

Total Solo HM: 7

Id: 90

League: ETH

Phuture Finance

Findings Distribution

Researcher Performance

Rank: 3/43

Findings: 2

Award: $4,045.80

🌟 Selected for report: 2

🚀 Solo Findings: 2

Findings Information

🌟 Selected for report: csanuragjain

Labels

bug
2 (Med Risk)

Awards

2022.9048 USDC - $2,022.90

External Links

Lines of code

https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/ChainlinkPriceOracle.sol#L60

Vulnerability details

Impact

Asset Manager can update the aggregator of an existing asset thus impacting all function making use of this asset. Ideally if an aggregator is already set for an asset the function should fail

Proof of Concept

  1. Asset Manager call function addAsset to adds an asset X with assetAggregator value as Y
  2. This is being utilized across application
  3. Now Asset Manager calls the same function addAsset with asset X with assetAggregator value as Z
  4. Asset aggregator value for asset X gets changed to Z even though it was already set to Y

addAsset should only work if assetInfoOf[_asset] value is empty

#0 - jn-lp

2022-05-11T14:28:13Z

Aggregators often break or are updated to new logic, the manager tracks these changes and sets the value to the current one

#1 - moose-code

2022-05-24T13:55:55Z

Have to assume that ASSET_MANAGER_ROLE is behaving honestly in the first place otherwise everything falls apart, so this is a centralization issue.

The big question is who is being given the ASSET_MANAGER_ROLE ? This role has the power to rug everyone in every index.

Given this is unclear who is given this role (can't see anything in codebase explicitly on it, no deploy scripts, no documentation on it), one can't know who is given ASSET_MANAGER_ROLE. Given this assumption, this is a valid finding as basically one asset manager could change the oracle for another asset managers index?

Going to give this one to the warden for bringing up a valid point.

Findings Information

🌟 Selected for report: csanuragjain

Labels

bug
2 (Med Risk)

Awards

2022.9048 USDC - $2,022.90

External Links

Lines of code

https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/ManagedIndex.sol#L35 https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/TopNMarketCapIndex.sol#L57 https://github.com/code-423n4/2022-04-phuture/blob/main/contracts/TrackedIndex.sol#L45

Vulnerability details

Impact

Initialize function can be called multiple times with same asset. Calling with same asset will make duplicate entries in assets list. Any function reading assets will get impacted and would retrieve duplicate asset

Proof of Concept

  1. Observe that initialize function can be called multiple times
  2. Admin calls initialize function with asset X
  3. asset X gets added in assets object
  4. Admin again calls initialize function with asset X
  5. asset X again gets added in assets object making duplicate entries

Add a check to fail if assets already contains the passed asset argument. Also add a modifier so that initialize could only be called once

require(!assets.contain(asset), "Asset already exists");

#0 - jn-lp

2022-05-11T13:11:28Z

We require caller of initialize method to be a factory (which is non-upgradable contract), so it can't be called twice

see:

require(msg.sender == factory, "ManagedIndex: FORBIDDEN");

#1 - moose-code

2022-05-24T13:58:53Z

Given the factory contract is not supplied it makes it impossible to know these things and hence siding with the warden for the disclosure.

" to be a factory (which is non-upgradable contract)" i.e. one can't know this if the factory is not supplied or documented.

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