Closed howlbot-integration[bot] closed 5 months ago
Picodes marked the issue as duplicate of #19
Picodes changed the severity to QA (Quality Assurance)
Picodes marked the issue as grade-b
@Picodes
How is this valid? Isn't this handled in the function
@ZanyBonzy Your argument is invalid as to pass _validatePositionList
in settleLongPremium
the token list must have been minted at some point and gone through the "mint options" flow.
Even apart from this, I think you have misinterpreted the issue here. The issue existed because of the number of positions overflowing 256, which can cause forgery, and not it being above MAX_POSITIONS
. The overflow has already been fixed in the updated PanopticMath.updatePositionHash()
function.
Picodes marked the issue as grade-c
Lines of code
https://github.com/code-423n4/2024-06-panoptic/blob/153f0d82440b7e63075d55b0659706531431145f/contracts/PanopticPool.sol#L1552-L1624
Vulnerability details
Impact
A full breakdown of issue M-02 from the previous audit can be found here, but the vulnerability involves because check for duplicate token ids is not implemented, causing that users can settle long premiums for other users when they're insolvent. The affected functions are functions in which the
_validateSolvency
function is used includingsettleLongPremium
,forceExercise
,burnOptions
,liquidate
andmintOptions
. The vulnerability was however mitigated in theliquidate
,forceExercise
,burnOptions
, andmintOptions
causing that it still exists in thesettleLongPremium
function. So solvency checks can be bypassed by users when settling long premium.Proof of Concept
The mitigation involves the check for hash not being more than MAX_POSITIONS, which can be found in the
_updatePositionsHash
function.The
_updatePositionsHash
is used in two places, the_addUserOption
which handles hash in the_mintOptions
function and in the_updatePositionDataBurn
function which is used when burning options. Options are burned upon when force exercising and when liquidating, so that handles the validation. The hash validation is however not done when settling long premium as can be seen by going through the function causing that the issue still exists and not fully mitigated.Tools Used
Manual code review
Recommended Mitigation Steps
Consider introducing the check in the
settleLongPremium
function.Assessed type
Other