DeFiFoundrySolidity
16,653 OP
View results
Submission Details
Severity: medium
Invalid

Use a nonReentrant modifier in _deployFunds function

Summary

The _deployFunds function calls transmuter.deposit, which is an external function. Without proper precautions, this can open the function to a read-only reentrancy attack, where the state could be manipulated in an unexpected way before the external call completes.

https://github.com/Cyfrin/2024-12-alchemix/blob/main/src/StrategyMainnet.sol#L80

Impact

Suppose a function (_deployFunds) calls an external contract like transmuter.deposit.

If transmuter.deposit allows a callback to another function in this contract, the attacker can call a view function balanceDeployed before _deployFunds completes its state changes.

Tools Used

Manual

Recommendations

Use a nonReentrant modifier to prevent reentrancy attacks.

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
contract StrategyMainnet is BaseStrategy, ReentrancyGuard {
function _deployFunds(uint256 _amount) internal override nonReentrant {
transmuter.deposit(_amount, address(this));
}
}
Updates

Appeal created

inallhonesty Lead Judge 5 months ago
Submission Judgement Published
Invalidated
Reason: Lack of quality
inallhonesty Lead Judge 5 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.