Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

[External Audit] Reentrancy in MultiInvoker due to calls to unauthenticated contracts #182

Open
arjun-io opened this issue Aug 23, 2023 · 4 comments
Labels
Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed

Comments

@arjun-io
Copy link

Description
The MultiInvoker.sol contract makes external calls to the Market and Vault contracts.
However, there’s no check that these are valid contracts registered with their respective factories.

Impact
MultiInvoker.sol can be called with arbitrary contracts which can lead to unexpected
reentrancy behavior.

Recommendations
MultiInvoker.sol should check the provided market or vault address against MarketF
actory.sol/VaultFactory.sol respectively to verify that it’s a valid instance.

@arjun-io arjun-io added Low/Info A valid Low/Informational severity issue Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed labels Aug 23, 2023
@141345 141345 added the Non-Reward This issue will not receive a payout label Aug 25, 2023
@hrishibhat
Copy link

These issues are not included in the contest pool rewards

@arjun-io
Copy link
Author

arjun-io commented Sep 1, 2023

Fixed: equilibria-xyz/perennial-v2#83

@MLON33
Copy link

MLON33 commented Sep 14, 2023

From WatchPug,

https://github.com/equilibria-xyz/perennial-v2/blob/f216b2fd0ec45ea22b443a00fdfe2257f803ce7c/packages/perennial-extensions/contracts/MultiInvoker.sol#L312-L331

Screenshot 2023-09-14 at 5 05 20 PM

While we cannot see a way to exploit this Reentrancy to unauthenticated contracts, the fix did prevent calls to unauthentic vaults and markets.

However, the COMMIT_PRICE action can still be used to call an unauthenticated oracleProvider.

@arjun-io
Copy link
Author

From WatchPug,

https://github.com/equilibria-xyz/perennial-v2/blob/f216b2fd0ec45ea22b443a00fdfe2257f803ce7c/packages/perennial-extensions/contracts/MultiInvoker.sol#L312-L331

Screenshot 2023-09-14 at 5 05 20 PM While we cannot see a way to exploit this Reentrancy to unauthenticated contracts, the fix did prevent calls to unauthentic vaults and markets.

However, the COMMIT_PRICE action can still be used to call an unauthenticated oracleProvider.

Since the oracle factory has multiple levels of abstraction this change can be quite complex so while we recognize this is true, since there is no clear malicious use here we're going to not add the oracle check.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Low/Info A valid Low/Informational severity issue Non-Reward This issue will not receive a payout Sponsor Confirmed The sponsor acknowledged this issue is valid Will Fix The sponsor confirmed this issue will be fixed
Projects
None yet
Development

No branches or pull requests

4 participants