# Zero-default authorization bypass

Trust checks comparing input to unset storage or zero-default variables that attacker input can match

_Area: Smart contract access control and control flow. Seen in 22 disclosed reports; latest 2026-05-04. Updated 2026-10-23._

## How it works
A trust decision compares attacker-influenced input against a stored value that was never set. Unset storage reads as zero (address(0), 0x00, threshold 0), so the comparison succeeds for input the attacker controls. The assumption that breaks: "the trusted value is configured" is never enforced. The code treats "equals the stored value" as "is trusted" without proving the stored value is meaningful. A related shape: a variable that defaults to the caller's own value (msg.sender) makes the comparison trivially true.

## Where it shows up
- Trust mappings keyed by domain/chain/root where some keys are never configured [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-hack-analysis-nomad-bridge-august-2022.md)[E2](https://bugbountylibrary.com/r/sherlock%3A2023-01-derby%3AH-6.md)
- `initialize()`/upgrade scripts writing zero or default values into trust state [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-hack-analysis-nomad-bridge-august-2022.md)
- Auth checks comparing `msg.sender` to a variable that itself defaults to `msg.sender` [E6](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AH-5.md)
- Sentinel `address(0)` meaning both "unset" and "self" in delegation guards [E3](https://bugbountylibrary.com/r/c4%3A2023-04-party%3AH-01.md)
- Threshold/parameter of 0 accepted at initialization for secret sharing or recovery [E4](https://bugbountylibrary.com/r/c4%3A2025-11-swafe%3AM-06.md)
- Setters that treat 0 as "uninitialized" and overwrite a deliberate zero [E7](https://bugbountylibrary.com/r/c4%3A2024-12-secondswap%3AM-12.md)

## How to review
For every authorization comparison, identify the trusted operand and prove it is non-zero/non-default before use. The invariant: a check passes only if the trusted value was explicitly configured and the input matches it; an unset key must fail closed. Enumerate all keys/domains the code may be called with and confirm each is configured or rejected. Grep for `== address(0)` guards and mapping reads with no prior set. For upgrades, diff every state variable written by initialize/migration against downstream readers [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-hack-analysis-nomad-bridge-august-2022.md). For sentinels, confirm zero cannot be both a legitimate choice and "unset" [E3](https://bugbountylibrary.com/r/c4%3A2023-04-party%3AH-01.md)[E7](https://bugbountylibrary.com/r/c4%3A2024-12-secondswap%3AM-12.md). For default-assignment branches, confirm the compared variable is always reassigned before the check [E6](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AH-5.md).

What this is not: a zero value that merely breaks a downstream consumer (revert, bricked function, tokens sent to address(0)) is a separate DoS/loss pattern, not an auth-comparison bypass [E5](https://bugbountylibrary.com/r/sherlock%3A2022-11-bullvbear%3AH-1.md)[E8](https://bugbountylibrary.com/r/cantina%3Azerolend_jan2024%3A3.2.12.md).

## Variants seen
- Upgrade set trusted root to 0x00, pre-approving any unproven message [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-hack-analysis-nomad-bridge-august-2022.md)
- Unconfigured origin domain matches zero default in onlySource [E2](https://bugbountylibrary.com/r/sherlock%3A2023-01-derby%3AH-6.md)
- Receiver defaults to msg.sender on non-standard address length [E6](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AH-5.md)
- Self-delegation stored as address(0), overwritten by third party [E3](https://bugbountylibrary.com/r/c4%3A2023-04-party%3AH-01.md)
- Recovery threshold 0 makes secret derivable from RIK alone [E4](https://bugbountylibrary.com/r/c4%3A2025-11-swafe%3AM-06.md)
- maxSellPercent 0 reinterpreted as uninitialized and reset [E7](https://bugbountylibrary.com/r/c4%3A2024-12-secondswap%3AM-12.md)

## Impact and severity
Ranges from total bridge drain ($190m) [E1](https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-hack-analysis-nomad-bridge-august-2022.md) and spoofed cross-chain messages corrupting vaults [E2](https://bugbountylibrary.com/r/sherlock%3A2023-01-derby%3AH-6.md), to theft of refunds [E6](https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AH-5.md), hijacked governance power [E3](https://bugbountylibrary.com/r/c4%3A2023-04-party%3AH-01.md), key recovery bypass [E4](https://bugbountylibrary.com/r/c4%3A2025-11-swafe%3AM-06.md), and unauthorized token sales [E7](https://bugbountylibrary.com/r/c4%3A2024-12-secondswap%3AM-12.md). Severity rises when the zero-default path is reachable by any caller and gates fund movement or irreversible state.

## Evidence
- E1: https://bugbountylibrary.com/r/blog%3Aimmunefi-com-blog-bug-fix-reviews-hack-analysis-nomad-bridge-august-2022.md
- E2: https://bugbountylibrary.com/r/sherlock%3A2023-01-derby%3AH-6.md
- E3: https://bugbountylibrary.com/r/c4%3A2023-04-party%3AH-01.md
- E4: https://bugbountylibrary.com/r/c4%3A2025-11-swafe%3AM-06.md
- E5: https://bugbountylibrary.com/r/sherlock%3A2022-11-bullvbear%3AH-1.md
- E6: https://bugbountylibrary.com/r/sherlock%3A2025-05-dodo-cross-chain-dex%3AH-5.md
- E7: https://bugbountylibrary.com/r/c4%3A2024-12-secondswap%3AM-12.md
- E8: https://bugbountylibrary.com/r/cantina%3Azerolend_jan2024%3A3.2.12.md
