The `startToken` function in the `CollateralTracker` contract is missing a critical modifier to ensure that only the associated Panoptic pool can call it #20
Detailed description of the impact of this finding.
Without the onlyPanopticPool modifier, any external entity can call startToken, potentially allowing unauthorized initialization of the collateral tracker. This could lead to incorrect tracking of collateral, manipulation of pool assets, and unauthorized changes to the state variables.
Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
The startToken function is intended to be called once by the factory to initialize the collateral tracking system. However, as it is currently implemented without the onlyPanopticPool modifier, it can be called by any address:
An attacker could potentially call this function with false parameters, leading to a misconfigured collateral tracker.
POC
File Name: test/foundry/core/CollateralTracker.t.sol
Prerequisite: Insert the test function beneath into line 597 just after the prior function in the CollateralTracker.t.sol file.
Then open terminal> CD into the panoptic root folder> and run: forge test -vvvvv --match-test test_Success_Unauth_StartToken_virtualShares --fork-url "https://eth-mainnet.g.alchemy.com/v2/{Token}"
Lines of code
https://github.com/code-423n4/2024-06-panoptic/blob/153f0d82440b7e63075d55b0659706531431145f/contracts/CollateralTracker.sol#L210-L249
Vulnerability details
Impact
Detailed description of the impact of this finding.
Without the
onlyPanopticPool
modifier, any external entity can callstartToken
, potentially allowing unauthorized initialization of the collateral tracker. This could lead to incorrect tracking of collateral, manipulation of pool assets, and unauthorized changes to the state variables.Proof of Concept
Provide direct links to all referenced code in GitHub. Add screenshots, logs, or any other relevant proof that illustrates the concept.
The
startToken
function is intended to be called once by the factory to initialize the collateral tracking system. However, as it is currently implemented without theonlyPanopticPool
modifier, it can be called by any address:An attacker could potentially call this function with false parameters, leading to a misconfigured collateral tracker.
POC
Tools Used
Manual review and Foundry for POC.
Recommended Mitigation Steps
To mitigate this issue, the startToken function should include the onlyPanopticPool modifier to restrict access to the associated Panoptic pool:
Additionally, consider implementing role-based access control (RBAC) to manage permissions more granularly and securely.
Assessed type
Access Control