The custom nonReentrant modifier in the InheritanceManager contract uses inline assembly with mismatched storage slots—checking one slot (using tload(1)
) while setting another (using tstore(0, 1)
). This flaw completely undermines the intended reentrancy protection, exposing sensitive functions to potential reentrancy attacks.
The contract implements a custom nonReentrant modifier with inline assembly. Instead of using the same storage slot for both checking and setting the reentrancy flag, the code reads from slot 1 but writes the flag into slot 0. Because the check does not “see” the flag value set in a different slot, reentrant calls are not prevented. As a result, functions protected by this modifier (such as sendETH) may be reentered by a malicious contract, allowing an attacker to withdraw funds multiple times or manipulate critical state variables.
Direct Impact: Attackers can exploit this flaw to drain funds or alter state by reentering vulnerable functions during external calls.
Manual code review and inline assembly analysis.
Foundry (Forge) unit tests to simulate reentrancy attacks.
Replace the custom nonReentrant modifier with a battle‑tested solution such as OpenZeppelin’s ReentrancyGuard
.
If a custom implementation is necessary, ensure that the same storage slot is used for both checking and setting the reentrancy flag.
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.