Core Contracts

Regnum Aurum Acquisition Corp
HardhatReal World AssetsNFT
77,280 USDC
View results
Submission Details
Severity: medium
Valid

Deposit() in Treasury can be DOSed

Summary

Deposit() in Treasury can be DOSed.

Vulnerability Details

Treasury contains _totalValue to record the total value across all tokens deposited into the contract. This variable is updated whenever tokens are deposited.

Treasury::depsoit()

function deposit(address token, uint256 amount) external override nonReentrant {
if (token == address(0)) revert InvalidAddress();
if (amount == 0) revert InvalidAmount();
IERC20(token).transferFrom(msg.sender, address(this), amount);
_balances[token] += amount;
@> _totalValue += amount;
emit Deposited(token, amount);
}

An attacker can create a malicious token and deposit type(uint256).max tokens into Treasury, efficiently inflate _totalValue to the max value, any subsequent deposits made by genuine users will revert due to underflow error.

Impact

Depost() is permanently DOSed.

Tools Used

Manual Review

Recommendations

Since _totalValue is not used, there is no need to update _totalValue in deposit() or withdraw().

Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Validated
Assigned finding tags:

Treasury::deposit increments _totalValue regardless of the token, be it malicious, different decimals, FoT etc.

Support

FAQs

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