How Do Collateral Management Functions Introduce Reentrancy Risk in Options Contracts?

Options contracts often require users to deposit collateral. The collateral management functions handle deposits, withdrawals, and liquidations.

If a withdrawal function for collateral is vulnerable to reentrancy, an attacker could withdraw more collateral than they are entitled to. Furthermore, if a liquidation function makes an external call before updating the collateral status, the attacker could re-enter to prevent liquidation or exploit the collateral pool.

What Is the Checks-Effects-Interactions Pattern and How Does It Prevent Reentrancy?
Can the CEI Pattern Prevent All Types of Reentrancy?
Why Must State Updates Occur before External Calls?
What Is Reentrancy and Why Is It a Critical Smart Contract Vulnerability?
How Can a Time-Lock Smart Contract Be Used to Prevent the Immediate Withdrawal of LP Tokens?
What Is the Preventative Measure Called Checks-Effects-Interactions?
What Is a Common Example of a Major Reentrancy Attack in Cryptocurrency History?
What Is a Reentrancy Attack in Smart Contract Security?

Glossar