Core Contracts

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

Fee-on-Transfer Token Vulnerability in Treasury Deposits

Summary

The Treasury contract’s deposit function records the full amount specified by the depositor without verifying the actual tokens received. This behavior can lead to discrepancies when depositing tokens that incur transfer fees (fee-on-transfer tokens). In such case, the Treasury’s internal records may overstate the available balance. When withdrawals are later attempted based on these inflated records, they can fail or result in accounting errors.

Vulnerability Details

The Treasury’s deposit function is implemented as follows:

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 function:

  • Calls transferFrom with the user-specified amount.

  • Unconditionally increments its internal _balances and _totalValue by that amount.

  • Does not verify whether the actual token balance increased by the expected amount

**Issue with Fee-on-Transfer Tokens: **When a token deducts a fee on transfer (for example, 1%):

  • A depositor attempting to deposit 100 tokens will only send 99 tokens to the Treasury.

  • However, the Treasury records a deposit of 100 tokens.

  • This discrepancy means that the internal accounting overstates the Treasury balance. Subsequent withdrawals or fund allocations based on the recorded value may fail if the Treasury only holds the reduced amount.

Impact

  • Withdrawal failures and corrupted accounting

Tools Used

  • Manual review

Recommendations

Modify the deposit function to check the Treasury’s token balance before and after the transfer. This ensures that only the actual received tokens are recorded.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 month ago
Submission Judgement Published
Validated
Assigned finding tags:

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

Treasury::deposit increments _balances[token] with amount, not taking FoT or rebasing into account

Support

FAQs

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