sherlock-audit / 2024-05-tokensoft-distributor-contracts-update-judging

2 stars 1 forks source link

NoOne - Arithmetic Overflow and Underflow Vulnerabilities in `adjust` Function #34

Closed sherlock-admin2 closed 4 weeks ago

sherlock-admin2 commented 1 month ago

NoOne

medium

Arithmetic Overflow and Underflow Vulnerabilities in adjust Function

Summary

The adjust function in the smart contract is designed to modify the quantity of tokens claimable by a user (beneficiary). However, it lacks safeguards against arithmetic overflows and underflows, posing significant security risks.

Vulnerability Detail

The function performs arithmetic operations (addition and subtraction) without any checks for overflows or underflows. This can result in incorrect token balances or potentially allow for manipulation of the contract’s state.

Impact

Tool used

Manual Review

Recommendation

Implement the SafeMath library from OpenZeppelin to handle all arithmetic operations. This will automatically manage overflow and underflow conditions, ensuring the safe execution of addition and subtraction.