# Non-atomic check-then-act race

Validation and the effect it guards split by an external call, upgrade window, or public commit step

_Area: Smart contract access control and control flow. Seen in 2 disclosed reports; latest 2025-06-30. Updated 2026-11-09._

## How it works
A check (is this caller allowed, is this resource free, is this stake locked) and the effect it guards (commit a header, set the active channel, register a name) are not performed as one atomic step. Between them sits an external call, a separate public function, or an upgradeable pointer that can change state. The assumption that breaks: that the state validated at check time is still true at effect time. Anyone who can act in that gap gets the effect without the constraint.

## Where it shows up
- A public commit/confirm function separate from the selection or validation step [E1](https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7.md)
- Getters that filter by one state (OPEN) while other states (FLUSHING, upgrade) still allow the guarded action [E2](https://bugbountylibrary.com/r/h1%3A2917368.md)
- Handshake/ack paths that set an "active" pointer via check-then-act [E2](https://bugbountylibrary.com/r/h1%3A2917368.md)
- Mutation paths (renew/extend/transfer) that skip a time bound enforced only on the claim path [E3](https://bugbountylibrary.com/r/c4%3A2025-01-initia-move%3AH-04.md)
- Stake or balance that can move while voting power derived from it stays live [E1](https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7.md)

## How to review
For each guarded effect, list every state read by the check and ask what can change it before the effect executes. The invariant: no external call, public entry point, or upgrade transition may occur between validation and effect, or the validation must be re-asserted at effect time. Check that state getters used for authorization include all states in which the action is still possible (FLUSHING, grace period, pending exit), not just the happy state [E2](https://bugbountylibrary.com/r/h1%3A2917368.md)[E3](https://bugbountylibrary.com/r/c4%3A2025-01-initia-move%3AH-04.md). Check that stake backing a vote cannot be withdrawn until the vote is committed or slashable [E1](https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7.md).

## How finders spotted it
- Read Settlement.sol and noticed commitValSetHeader is public and separate from setSigVerifier, exposing a window between selection and commitment [E1](https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7.md)
- Read ICA handshake keepers: active channel set on ack is check-then-act, and GetOpenActiveChannel returns only OPEN, not FLUSHING; host open confirm likewise non-atomic — hypothesized a race during upgrade [E2](https://bugbountylibrary.com/r/h1%3A2917368.md)
- Read name_service.move and saw extend_expiration had no bound against expiration_date + grace_period, contradicting the claim invariant [E3](https://bugbountylibrary.com/r/c4%3A2025-01-initia-move%3AH-04.md)

## Variants seen
- Stake-exit lag: withdraw stake before committing a valset header, keep voting power, no slashing risk [E1](https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7.md)
- Channel replacement during upgrade: malicious channel acked/confirmed in the victim's FLUSHING window becomes active, changing encoding [E2](https://bugbountylibrary.com/r/h1%3A2917368.md)
- Grace-period bypass: prior owner extends expiration after grace, frontrunning a new buyer [E3](https://bugbountylibrary.com/r/c4%3A2025-01-initia-move%3AH-04.md)

## Impact and severity
E1 lets an operator control consensus without risking stake — high, because it removes the economic security assumption. E2 lets an attacker hijack the active ICA channel and its encoding — high, reaching cross-chain message integrity. E3 blocks legitimate registrations and lets the prior owner retain a name — medium, gated by frontrunning. Impact rises when the gap is repeatable (pre-set one malicious channel per upgrade [E2](https://bugbountylibrary.com/r/h1%3A2917368.md)) or when the guarded effect is consensus or cross-chain state [E1](https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7.md)[E2](https://bugbountylibrary.com/r/h1%3A2917368.md).

## Evidence
- E1: https://bugbountylibrary.com/r/sherlock%3A2025-06-symbiotic-relay%3AM-7.md
- E2: https://bugbountylibrary.com/r/h1%3A2917368.md
- E3: https://bugbountylibrary.com/r/c4%3A2025-01-initia-move%3AH-04.md
