Open howlbot-integration[bot] opened 5 months ago
Picodes marked the issue as duplicate of #38
Picodes changed the severity to QA (Quality Assurance)
Picodes marked the issue as grade-b
Per direction from the judge, staff have marked as 1st place. Also noting there was a tie for 1st/2nd place.
Lines of code
https://github.com/code-423n4/2024-06-panoptic/blob/main/contracts/CollateralTracker.sol#L578
Vulnerability details
Impact
The lack of overflow validation allows s_poolAssets to be manipulated. Once overflow occurs, totalAssets can be set higher than the actual collaterals, preventing other users from withdrawing their own collateral due to the incorrect totalAssets.
Proof of Concept
totalAssets
is calculated as the sum ofs_poolAssets
ands_inAMM
.If a user owns 50% of the
totalShares
, their withdrawal assets are calculated as:If
s_inAMM
is significantly larger thans_poolAssets
, the calculated assets can exceeds_poolAssets
, leading to an overflow ofs_poolAssets
.s_poolAssets
ands_inAMM
are calculated in thetakeCommissionAddData
function.Tools Used
Manual review
Recommended Mitigation Steps
Add overflow validation or remove the unchecked to prevent manipulation of s_poolAssets.
Assessed type
Under/Overflow