A possible overflow issue will occur if the usdcAmount
(a uint256
) is explicitly or implicitly cast to uint128
causing a Denial of Service Attack.
Here is the Line of Code in question:
Implicit/Explicit Casting: If the usdcAmount
(a uint256
) is cast to uint128
in the unshown logic (e.g., in the else
block when interacting with external protocols or functions that expect uint128
), it could overflow.
Example: uint128 amount = uint128(usdcAmount);
Truncation Risk: If usdcAmount
exceeds 2^128 - 1
, casting it to uint128
truncates the higher bits, resulting in an incorrect value (e.g., 2^128
becomes 0
).
This Overflow risk will cause DOS which will bring about inconsistency in the conversion of Usdc to Assets putting funds at risk.
Manual Review
Use explicit checks or SafeCast to handle the conversion safely
// Using OpenZeppelin's SafeCast````import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";
// In the code:````uint128 safeUsdcAmount = SafeCast.toUint128(usdcAmount); // Reverts on overflow
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.