The function getTotalCreditCapacityUsd
in the Vault
library calls IERC4626(self.indexToken).totalAssets()
, which interacts with an external contract. If the external contract has a malicious implementation, it could re-enter and manipulate values before execution completes. This could allow an attacker to alter the vault’s total credit capacity, leading to financial loss.
The function retrieves total asset data using:
Since this call is made inside a library, it lacks built-in reentrancy protection and depends on the calling contract's security measures. A malicious ERC-4626 vault can exploit this by re-entering the function before execution completes, leading to manipulated credit capacity calculations.
The Vault
library makes an external call without enforcing reentrancy protection.
Because the function does not follow Checks-Effects-Interactions, it can be manipulated by re-entrant attacks.
Attackers can manipulate the vault’s total credit capacity by deploying a malicious ERC-4626 vault.
This can lead to incorrect financial calculations and fund mismanagement.
Hardhat (for proof-of-concept testing)
Slither (for static analysis)
Foundry (for further fuzz testing)
i simulate the vulnerability using a malicious ERC-4626 vault that re-enters the function.
i create a vault that exploits the vulnerability:
Since libraries do not support state variables (so we can't use ReentrancyGuard
), we must apply the Checks-Effects-Interactions pattern:
Instead of fetching totalAssets()
at the start, first perform all state-dependent calculations:
Another approach is storing the value first and then fetching assets later:
The getTotalCreditCapacityUsd
function is vulnerable to re-entrancy because it calls an external function before completing internal logic. Since this function is in a library, we cannot use ReentrancyGuard
. Instead, the best mitigation is following Checks-Effects-Interactions by ensuring that external calls happen last in the function execution order.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.