Skip to content
On this page

S2C8: Multi-Lock Contract

1. Problem

The contract has multiple "lock" mechanisms that must be unlocked sequentially before mintFlag can be called. Each lock has different unlock conditions (such as paying ETH, specific states, storage operations, etc.).

2. Cause

The contract implements layered access control — multiple modifiers or condition checks stacked together. Each layer can be unlocked through specific operations.

3. Solution

  1. Read contract storage to analyze the state of each lock
  2. Unlock each lock in order (send ETH, call specific functions, write storage)
  3. Call mintFlag after all locks are unlocked

4. Pitfalls Encountered

Lock Dependencies: Some locks may depend on the state of other locks, so the unlocking order may matter. The attack contract needs to have ETH deposited in advance.

5. Pitfall Causes

There may be dependencies between the contract's state variables. Operating in the wrong order could cause state resets or transaction reverts.

6. How to Resolve

Read lock states one by one via cast storage, and design atomic operations to unlock all locks in a single transaction.

7. Key Technical Points

PointDescription
Multi-layer access controlContract design with multiple modifiers/conditions stacked
Atomic operationsComplete all unlocks and mint in a single transaction
Storage analysisRead storage slots to understand contract state

Built with AiAda