# Beebots.TradeValid() Will Erroneously Return True When Maker Is Set To Address(0) and makerIds Are Set To The TokenIds of Unminted Beebot NFTs

Beebots.verify() accepts any signature when signer is address(0), and unminted NFTs map to owner address(0), so tradeValid() returns true for fake trades.

- Payout: Audit contest
- Severity: high
- Program: LarvaLabs Meebits
- Disclosed: 2021-06-30
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2021-04-meebits-findings/issues/77
- Library page: https://bugbountylibrary.com/r/c4%3A2021-04-meebits%3AH-03
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:high tech:evm tech:solidity vuln:auth-bypass vuln:business-logic

**Target:** Beebots NFT trade validation contract (verify/tradeValid)
**Root cause:** verify() never rejects signer==address(0), and ecrecover silently returns address(0) on signature mismatch, so any signature validates. Separately, idToOwner defaults to address(0) for unminted tokenIds, matching the zero maker.
**Steps:**
1. Call `Beebots.verify()` with signer set to `address(0)` and any arbitrary signature; ecrecover returns `address(0)` on mismatch, matching signer, so it returns true.
2. Call `Beebots.tradeValid()` with `maker` set to `address(0)` and `makerIds` set to tokenIds of unminted Beebot NFTs.
3. idToOwner for unminted ids is `address(0)`, matching maker, so tradeValid() erroneously returns true.
**How found:** Code reading: noticed verify() lacks a zero-signer check, reasoned that ecrecover fails silently to address(0), then connected it to Solidity's zero-initialized idToOwner mapping for unminted tokens.
**Exploitation:** Attacker submits a trade with maker=address(0) and makerIds of unminted NFTs; verify() passes because ecrecover yields address(0), and ownership check passes because unminted ids map to address(0), making an invalid trade appear valid.
**Insight:** Whenever ecrecover output is compared to a caller-supplied signer, check for a missing signer!=address(0) guard; also treat zero-initialized ownership mappings as 'owned by 0x0' for unminted ids and ensure maker/owner checks reject address(0).

