Normal behavior:
The contract should correctly set the buy fee (s_buyFee) by multiplying a base fee (_buyFee) with a precision constant (PRECISION = 10^18) to handle decimal scaling without overflow.
Issue:
The multiplication _buyFee * PRECISION occurs without any upper bound checks on _buyFee. If _buyFee is set too high during contract deployment or initialization, the multiplication could overflow the uint256 capacity. Although Solidity 0.8.24 automatically reverts on overflow, the absence of explicit validation allows the possibility of a revert during deployment or runtime, causing denial of service or unexpected failures.
Likelihood:
Low to Medium — Overflow only occurs if _buyFee is set extremely large, which is uncommon but possible if no input validation exists.
Could happen at deployment or if _buyFee is modifiable later without checks.
Impact:
:
Medium — Overflow causes transaction revert, potentially locking contract functionality related to buying tokens.
Denial of service for users attempting to buy tokens if the contract is stuck in a faulty state.
Explanation:
Legitimate user: user deploys the OverflowPoC contract with a valid _buyFee.
Attacker: The attacker (or the contract deployer) sets a very large value for _buyFee, which causes the multiplication _buyFee * PRECISION to overflow.
The deployment fails, reverting the contract creation and preventing a successful deployment, which leads to a denial of service.
Explanation:
Solution: Refactor the constructor to validate the input _buyFee before multiplication, ensuring it does not exceed a safe maximum value.
Security: The fix prevents overflow by ensuring that _buyFee does not exceed a predefined maximum value (MAX_BUY_FEE), protecting against unintended overflows and contract reverts.
Efficiency: This fix ensures safe contract behavior without introducing significant inefficiencies, while avoiding failed deployments or transactions due to overflows.
Compatibility: The fix is backward-compatible and will not break existing protocol interfaces, but ensures safer contract operations.
This vulnerability is considered critical because it can prevent the deployment or upgrade of the contract, locking the functionality of token purchases indefinitely. The fix restores functionality and ensures safe contract initialization.
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.