Core Contracts

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

Lack of `safeTransfer` in `withdraw` Function May Cause Silent Failures

Summary

The withdraw function in the contract directly uses IERC20(token).transfer(recipient, amount); instead of SafeERC20.safeTransfer. This can result in silent failures for ERC-20 tokens that do not return a boolean value, potentially locking funds.

Vulnerability Details

Some ERC-20 tokens do not adhere strictly to the ERC-20 standard and may:

  1. Return no value at all, causing silent failures. eg USDT, BNB

  2. Revert instead of returning false, making it unclear whether the transfer was successful. eg AAVE

  3. Use non-standard implementations that require handling failures explicitly.

Using IERC20(token).transfer(...) directly assumes all tokens follow the standard correctly. However, some tokens (such as USDT) do not return a boolean, leading to potential issues where:

  • The transfer appears to succeed, but funds are not actually sent.

  • The _balances and _totalValue state variables are updated incorrectly, desynchronizing internal accounting and most likely locking of those assets as the contract as the state update reflects they have been withdrawn.

Affected Code:

IERC20(token).transfer(recipient, amount);

Impact

  • If a transfer fails silently, the contract updates _balances[token] and _totalValue even though no actual transfer occurred, leading to incorrect balances.

  • Users may permanently lose access to their funds due to the discrepancy between the recorded balance and the actual token holdings.

  • Attackers may exploit this flaw to drain contract balances by forcing silent failures on specific tokens.

Tools Used

Manual review.

Recommendations

Use OpenZeppelin’s SafeERC20 library and replace transfer with safeTransfer:

Recommended Fix:

using SafeERC20 for IERC20;
function withdraw(
address token,
uint256 amount,
address recipient
) external override nonReentrant onlyRole(MANAGER_ROLE) {
// Other code ...
IERC20(token).safeTransfer(recipient, amount); // Use safeTransfer to handle failures safely
emit Withdrawn(token, amount, recipient);
}

This ensures that token transfers do not silently fail and revert properly if a transfer is unsuccessful.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Known issue
Assigned finding tags:

[INVALID] SafeERC20 not used

LightChaser Low-60

Support

FAQs

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

Give us feedback!