# Prevent execution with invalid signatures

Ambire Identity.sol: if a constructor addr is 0, privileges[0]=1, so ecrecover returning 0 on invalid signatures lets anyone execute arbitrary transactions.

- Payout: Audit contest
- Severity: high
- Program: Ambire
- Found by: gpersoon
- Disclosed: 2021-11-11
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2021-10-ambire-findings/issues/13
- Library page: https://bugbountylibrary.com/r/c4%3A2021-10-ambire%3AH-01
- Tags: area:web3 domain:web3 impact:funds-loss kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:auth-bypass

**Target:** Smart contract account (Identity.sol) signature validation
**Root cause:** Constructor sets privileges[addrs[i]]=1 without rejecting address(0); ecrecover/recoverAddrImpl returns 0 for invalid signatures, and privileges[0]!=0 passes the signer check.
**Steps:**
1. Deploy Identity with an addrs[] entry equal to address(0), setting privileges[0]=1
2. Call `execute()` with an arbitrary invalid signature
3. `recoverAddrImpl` returns 0, so signer=0
4. Check `privileges[signer] != 0` passes (privileges[0]=1)
5. Arbitrary transaction executes as the identity
**How found:** Code reading of constructor privilege assignment and the execute() signer check; noticed ecrecover returns 0 on invalid sigs and that 0 could be a privileged key.
**Exploitation:** Attacker submits execute() with any malformed signature; ecrecover yields address(0), which holds privileges, so the call is authorized and arbitrary logic runs from the account.
**Insight:** When authorization relies on ecrecover, treat address(0) as a valid-looking signer: audit whether zero can ever be granted privileges via constructor, setters, or directly-sstore'd proxy bytecode.
