Beginner FriendlyFoundryNFT
100 EXP
View results
Submission Details
Severity: high
Valid

Arithmetic Overflows/Underflows Leading to Financial Miscalculations

Summary

This vulnerability arises due to the absence of overflow and underflow checks in arithmetic operations, as the contract is written in a Solidity version prior to 0.8.0. This could lead to incorrect calculations and potentially exploitable conditions, impacting the financial integrity of the contract.

Vulnerability Details

Integer overflow and underflow occur when an arithmetic operation reaches the maximum or minimum limit of the data type and wraps around to the opposite value, respectively. In Solidity versions prior to 0.8.0, arithmetic operations do not automatically check for these conditions, and they could lead to unexpected and incorrect results. In this specific contract, there is a risk of integer overflow in the totalFees variable, as it keeps accumulating fees without a cap. If this value becomes large enough, it could overflow and wrap around, leading to inaccurate accounting of fees.

Impact

The impact of integer overflow/underflow in this smart contract can be severe, depending on how the affected variables are used throughout the contract:

Financial Loss: If the affected variables are tied to financial transactions, balances, or asset ownership, integer overflow/underflow could lead to incorrect calculations, resulting in unintended gains for attackers or losses for legitimate users.

Manipulation: Attackers could exploit these vulnerabilities to manipulate the contract’s behavior to their advantage. For example, by causing an overflow in a balance variable, an attacker might be able to bypass checks that prevent excessive withdrawals.

Tools Used

Foundry, manual

Recommendations

Use 0.8.0 and above

Updates

Lead Judging Commences

Hamiltonite Lead Judge about 2 years ago
Submission Judgement Published
Validated
Assigned finding tags:

overflow-uint64

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!