# verify_origin() previous_sender may be forged

AMPReceive origin check in Andromeda ADO only validates origin, letting any user forge previous_sender to bypass contains_sender permission checks like cw721 mint.

- Payout: Contest reward
- Severity: high
- Program: Andromeda Ado
- Credited: bin2chen
- Disclosed: 2024-05-14
- Write-up quality: 7/10
- Original: https://github.com/sherlock-audit/2024-05-andromeda-ado-judging/issues/45
- Library page: https://bugbountylibrary.com/r/sherlock%3A2024-05-andromeda-ado%3AH-1
- Tags: domain:web3 impact:integrity kind:contest platform:sherlock sev:high tech:rust technique:source-review vuln:access-control vuln:auth-bypass

**Target:** CosmWasm ADO contracts (AMPPkt.verify_origin / execute_amp_receive)
**Root cause:** verify_origin() only checks info.sender == ctx.origin for user-submitted AMPReceive packets and never validates ctx.previous_sender, so a user can set previous_sender arbitrarily.
**Steps:**
1. Identify an ADO (e.g. andromeda-cw721) whose handler gates on ctx.contains_sender(minter)
2. Submit `ExecuteMsg::AMPReceive(pkt)` directly to the contract with `ctx.origin = attacker` and `ctx.previous_sender = minter_address`
3. verify_origin passes since info.sender == origin; contains_sender returns true via get_previous_sender()
4. Call execute_mint and mint tokens without being the minter
**How found:** Code review of execute_amp_receive/verify_origin enumerating the three sender cases; noticed case 3 only constrains origin, then traced contains_sender() consumers to find cw721 mint permission check relying on previous_sender.
**Exploitation:** Attacker directly submits an AMPReceive packet to a permissioned ADO, spoofing previous_sender as the required minter/authorized address, satisfying contains_sender() and executing privileged actions such as cw721 minting.
**Insight:** When an auth check accepts multiple identity fields (origin OR previous_sender), audit each field's validation independently; a trusted field can mask an unvalidated sibling that downstream permission helpers consume.
