Core Contracts

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

REENTRANCY VULNERABILITY and allowing attackers to drain funds

Summary

Unprotected external calls in ReserveLibrary.sol enable reentrancy in LendingPool.sol, allowing attackers to drain funds. IMMEDIATE AND DECISIVE ACTION IS NON-NEGOTIABLE.

Vulnerability Details:

ReserveLibrary.sol's deposit and withdraw functions execute external calls (safeTransferFrom, IRToken.mint, IRToken.burn) without reentrancy protection. LendingPool.sol's deposit, withdraw, borrow, repay, depositNFT, withdrawNFT, initiateLiquidation, and closeLiquidation functions call these vulnerable ReserveLibrary.sol functions. A malicious contract, acting as the reserve asset token, can re-enter LendingPool.sol during the ERC20 transferFrom callback within ReserveLibrary.sol.deposit, bypassing intended logic and state updates. Similar reentrancy vectors exist in ReserveLibrary.sol.withdraw via IRToken.burn and are exploitable through LendingPool.sol.withdraw.

Impact:

fund loss as the yulnerability enables a Malacious attacker to manipulate the core deposit and withdrawal functions in LendingPool.sol, leading to unauthorized RToken minting during deposits and excessive reserve asset withdrawals. By exploiting this re-entrancy condition, an attacker can systematically drain the lending pool's liquidity and artificially inflate their token balances. The presence of this vulnerability in primary fund flow paths represents a critical risk to protocol solvency and user assets.

Recommendations:

  1. Immediate Mitigation: Wrap LendingPool.sol's deposit, withdraw, borrow, repay, depositNFT, withdrawNFT, initiateLiquidation, and
    closeLiquidation functions with @openzeppelin/contracts/utils/ReentrancyGuard's nonReentrant modifier.

  2. Code Review: Thoroughly audit all functions in LendingPool.sol and ReserveLibrary.sol for external calls and potential reentrancy vectors.

  3. Testing: Implement comprehensive reentrancy tests.

Mitigation:

In LendingPool.sol, wrap vulnerable functions with nonReentrant:

contract LendingPool is ILendingPool, Ownable, ReentrancyGuard, ERC721Holder, Pausable {
// ... other code ...
function deposit(uint256 amount) external nonReentrant whenNotPaused onlyValidAmount(amount) { // <--- Added nonReentrant
// ... deposit logic ...
}
function withdraw(uint256 amount) external nonReentrant whenNotPaused onlyValidAmount(amount) { // <--- added nonReentrant
// ... withdraw logic ...
}
// and similarly for other vulnerable functions
}
Updates

Lead Judging Commences

inallhonesty Lead Judge 4 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality

Support

FAQs

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