hats-finance / Metrom-0xfdfc6d4ac5807d7460da20a3a1c0c84ef2b9c5a2

Smart contracts for the Metrom project.
GNU General Public License v3.0
0 stars 0 forks source link

`_bundle.chainId` must be validated on campaign creation in `createCampaigns()` #55

Open hats-bug-reporter[bot] opened 5 months ago

hats-bug-reporter[bot] commented 5 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0x46de6f36814102b66249d60cdba86a0cf9b5845d6f37ceadd0e52bc7be26ab34 Severity: medium

Description: Description\ - SUMMARY -

Given that the contracts will be deployed on multiple chains depending on the demand, it is important that the chainIds are validated.

- DETAILS -

Looking at the code below, _bundle.chainId is not validated which may cause wrong information to slip in the system and event emissions.

- IMPACT -

When the wrong chainId slips in the system and event emitted:

  1. May cause revert if the reward tokens are sent mistakenly to a wrong chain.
  2. May cause loss of funds if the reward tokens are sent mistakenly to a wrong chain when the recipient account is from a centralized exchange.
  3. Reputational risk if the users realize that the wrong chainId is being used.

- MITIGATION -

Call block.chainid and compare it with _bundle.chainId. Revert the function if they are not equal.

Attachments

  1. Proof of Concept (PoC) File n/a

  2. Revised Code File (Optional) n/a

luzzif commented 5 months ago

The chainId in this context just refers to the chain id where the targeted pool lives, not the chain id of the Metrom campaign being created. As such, this data along with the pool address is indexed by the backend and validated there.

0xgreywolf commented 5 months ago

Thank you for the explanation.