Tadle

Tadle
DeFiFoundry
27,750 USDC
View results
Submission Details
Severity: high
Invalid

Potential Reentrancy in tillIn

Summary

The tillIn function interacts with external contracts in a way that could potentially lead to reentrancy attacks.

Vulnerability Details

https://github.com/Cyfrin/2024-08-tadle/blob/04fd8634701697184a3f3a5558b41c109866e5f8/src/core/TokenManager.sol#L56-L103

IWrappedNativeToken(wrappedNativeToken).deposit{value: _amount}();
_safe_transfer(wrappedNativeToken, capitalPoolAddr, _amount);

This sequence of operations interacts with an external contract before completing its state changes.

Impact

While unlikely with standard WETH implementations, a malicious or upgraded wrappedNativeToken contract could potentially reenter the tillIn function, leading to unexpected behavior or fund drainage.

Tools Used

manual code review

Recommendations

Include a reentrancy guard and follow the checks-effects-interactions pattern by updating state before interacting with external contracts

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract TokenManager is ReentrancyGuard, ... {
function tillIn(...) external payable nonReentrant {
// ... existing code ...
}
}
Updates

Lead Judging Commences

0xnevi Lead Judge
about 1 year ago
0xnevi Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Out of scope

Support

FAQs

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