Closed c4-bot-10 closed 4 months ago
The only time the share price changes meaningfully is when there is a commission fee at mint/burn, which is intended. Other components of the tokenToPay are reflected in the inAMM/poolAssets trackers.
Picodes marked the issue as unsatisfactory: Insufficient proof
@dyedm1 Can you elaborate more on what you mean by "meaningfully"/ why you think this is invalid?
Can you point out what is wrong with the proof provided?
Thanks.
Lines of code
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L1067-L1079 https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L1010-L1022
Vulnerability details
While minting/burning options, the
PanopticPool.sol
calls thetakeCommissionAddData()
/exercise()
function inCollateralTracker.sol
.tokenToPay
is the premium to paid/collected when the position is closed. The function converts this amount into the corresponding shares that need to be minted/burned for the user. However, the current calculation does not account for the impact of the minting/burning ontotalSupply
. The calculation also does not account for the changes intotalAssets()
due the swapped amountswappedAmount
.Impact
If the user's shares were burnt, this would mean that the value of
totalSupply()
decreased, and therefore the user's remaining shares would be worth more. Whereas, if they were minted, the value oftotalSupply()
would increase, and the value of thesharesToMint
that was calculated to compensate the user for the equivalent amount of tokens would be lesser than it should be. These inaccuracies would lead to the user being incorrectly compensated/charged while burning options.Proof of Concept
Note: This PoC does not take into account the changes to
totalAssets()
during the exercise, however, the impact would be similar since it's not related to the change intotalSupply()
. Additionally, it could be argued thatupdatedAssets
should be used in the calculation as well as the post function call value oftotalAssets()
is directly dependent on this value.Tools Used
Manual Review
Recommended Mitigation Steps
Account for the minted/burnt shares in the calculation of
sharesToBurn
/sharesToMint
variables inCollateralTracker.sol::exercise()
andCollateralTracker.sol::takeCommissionAddData()
Assessed type
Error