ERC-777 hook reentrancy
Token callbacks can re-enter before balances settle. Treat every transfer as an external interaction, including ERC-20-compatible tokens with hooks.
Risk assessment
Token callbacks can re-enter before balances settle. Treat every transfer as an external interaction, including ERC-20-compatible tokens with hooks.
Mitigation
Debit credit before transfer and protect all entry points sharing the same accounting state.
Solidity mitigation excerpt
credit[msg.sender] -= amount;
asset.safeTransfer(msg.sender, amount);Foundry · Regression check
With a supported mock token, confirm one withdrawal reduces credit exactly once and a repeated withdrawal cannot exceed the original entitlement.
Mitigation
Related topics
What should I verify first?
With a supported mock token, confirm one withdrawal reduces credit exactly once and a repeated withdrawal cannot exceed the original entitlement.