Closed code423n4 closed 1 year ago
Not sure if valid given that the tainted path isn't given/provided and is only hypothetical here. Issue would be valid if warden can provide a tainted path to get this state
JustDravee marked the issue as primary issue
AFAIK this is not possible and if you think it's possible, please provide an scenario
mubaris marked the issue as sponsor disputed
Open to a coded POC during Post-Judging QA, otherwise this'll be considered as a hand-waved hypothesis
JustDravee marked the issue as unsatisfactory: Insufficient proof
Lines of code
https://github.com/code-423n4/2023-03-polynomial/blob/aeecafc8aaceab1ebeb94117459946032ccdff1e/src/LiquidityPool.sol#L340-L365
Vulnerability details
Impact
LiquidityPool.getTokenPrice
can revert.Proof of Concept
In the implementation of
LiquidityPool.getTokenPrice
,totalValue
is updated as follows.When there are long positions, usedFunds will be negative and
amountOwed
can be less than-usedFunds
when the base asset price goes down. Soint256(amountOwed) + usedFunds
will be less than 0 and it will be a huge value after converted to uint256. As a result,getTokenPrice
will revert.Tools Used
Manual Review
Recommended Mitigation Steps
We can add validation
int256(amountOwed) + usedFunds >= 0
to prevent underflow.