When force-exercising fee is calculated, the amount for loss in value in chunk is summed up so that it can be compensated for the option buyer, but by a mistake, the amount is not added up at last, thus it is ignored.
Proof of Concept
In CollateralTracker contract on L711-720, it calculates the amount of value in loss in the chunk:
Lines of code
https://github.com/code-423n4/2024-04-panoptic/blob/833312ebd600665b577fbd9c03ffa0daf250ed24/contracts/CollateralTracker.sol#L730-L732
Vulnerability details
Impact
When force-exercising fee is calculated, the amount for loss in value in chunk is summed up so that it can be compensated for the option buyer, but by a mistake, the amount is not added up at last, thus it is ignored.
Proof of Concept
In
CollateralTracker
contract on L711-720, it calculates the amount of value in loss in the chunk:However at the end of the function when it calculates final amount of exercise fee, the calculated value is ignored:
As shown above, by using
toRightSlot
andtoLeftSlot
, originalexerciseFees
value is overwritten bylongAmounts * fee
.Tools Used
Manual Review
Recommended Mitigation Steps
The pre-calculated amount has to be added to the final amount so that:
Assessed type
Context