What Would Be the Vulnerable Code Structure That Violates the CEI Pattern?
A vulnerable code structure violates CEI by performing the external interaction before the state change. For example, a withdrawal function that first sends the Ether ( msg.sender.call{value: amount}("") ) and then updates the user's balance ( balance = 0 ) is vulnerable.
The attacker's fallback function is executed during the external call, allowing them to re-enter and withdraw again before the balance is zeroed.
Glossar
Vulnerable Code Structure
Structure ⎊ Vulnerable Code Structure refers to architectural or organizational deficiencies within a smart contract's codebase that create latent security weaknesses, even if individual functions appear correct.
Vulnerable Code
Concept ⎊ This term identifies segments of smart contract or exchange software logic that contain exploitable weaknesses, such as reentrancy bugs or improper access controls, which could compromise derivative positions or collateral.