A critical vulnerability in the nonReentrant
modifier fails to prevent reentrancy, allowing attackers to drain funds. By fixing the transient storage key usage and following secure coding practices, contracts can effectively mitigate reentrancy risks.
Modifier: InheritanceManager::nonReentrant()
Function: InheritanceManager::sendERC20()
Function: InheritanceManager::sendETH()
Function: InheritanceManager::contractInteractions()
The modifier uses inconsistent transient storage keys, rendering the reentrancy check ineffective.
Incorrect Check (tload(1)
)
The function checks key 1
, but the lock is stored at key 0
.
This results in tload(1)
always returning 0
, failing to detect reentrancy.
No Effective Reentrancy Prevention
Since tload(1) == 0
on every execution, attackers can continuously re-enter the function.
A flaw in the nonReentrant
modifier allows reentrancy attacks, which can lead to fund theft, unexpected contract behavior, and potential exploitation of the protocol.
Foundry
Use a consistent key (tload(0)
) for checking and setting the lock:
Apply the "Checks-Effects-Interactions" Pattern
Update state before external calls:
2 Use OpenZeppelin’s ReentrancyGuard
Instead
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.