The sumReturnUint256
function in the MarketUtils
library contains an issue that can lead to integer underflow when handling negative values. This vulnerability can be exploited to manipulate the contract's behavior, potentially leading to unintended consequences in financial calculations.
The sumReturnUint256
function handles the addition and subtraction of unsigned integers (uint256
) and signed integers (int256
). When the signed integer b
is negative, the function attempts to subtract a positive value from a
. If a
is smaller than the absolute value of b
, this results in an underflow.
willPositionCollateralBeSufficient
function relies on getMinCollateralFactorForOpenInterest
to determine the minimum collateral required based on the current market conditions and open interest. When absolute value of b
is greater than a
, the function will revert because of underflow therefore traders may failed to decrease their positions even when collateral is sufficient and also if a liquidation relies on willPositionCollateralBeSufficient
, it could fail to execute, allowing undercollateralized positions to remain open longer than intended.
Manual Review
Implement checks to prevent the underflow
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.