Core Contracts

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

Attacker is able to DoS the Treasury.sol

Summary

Attacker is able to DoS the Treasury.sol using transfering from a malicious token

Vulnerability Details

The deposit function in Treasury.sol allows any user to call it with arbitrary inputs for token and amount:

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);
}

The issue arises if an attacker deploys a malicious token contract and calls deposit with type(uint256).max. This would cause _totalValue to reach type(uint256).max, leading to an overflow. As a result, all subsequent calls to deposit would fail due to arithmetic overflow.

Attacker can also DoS the withdraw by causing a revert on the transfer call, preventing the MANAGER_ROLE from decreasing _totalValue via withdraw.

Note: A similar issue was identified in the Lightchaser report, where allowing type(uint256).max as an amount caused problems with tokens like cUSDCv3. However, simply preventing users from passing type(uint256).max is insufficient to prevent the vulnerability described in this report, as an attacker could reach type(uint256).max through multiple deposits.

Impact

Treasury.sol can be completely DoSed.

Tools Used

Manual Review

Recommendations

Consider implementing one of the following mitigations:

  1. Restrict access to deposit to authorized roles only.

  2. Implement a whitelist for accepted tokens.

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.