# Add members to the not yet created community

addMember accepts arbitrary _communityID; for an uncreated community owner is address(0), and recoverKey returns address(0) on malformed signature, so attacker self-signs and pre-adds members.

- Payout: Contest reward
- Severity: high
- Program: Rigor Protocol
- Disclosed: 2022-09-12
- Write-up quality: 7/10
- Original: https://github.com/code-423n4/2022-08-rigor-findings/issues/298
- Library page: https://bugbountylibrary.com/r/c4%3A2022-08-rigor%3AH-05
- Tags: domain:web3 impact:integrity kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:auth-bypass

**Target:** Community.sol addMember / SignatureDecoder.recoverKey
**Root cause:** addMember decodes _communityID from user data without checking the community exists; for a not-yet-created community _community.owner is address(0), and checkSignatureValidity passes when recoverKey returns address(0) (malformed signature length or v not 27/28).
**Steps:**
1. Choose _communityID = communityCount + 1 (next community to be created).
2. Craft _data = abi.encode(_communityID, attackerAddr, messageHash).
3. Provide _signature with length not multiple of 65 (or v != 27/28) so recoverKey returns address(0), satisfying checkSignatureValidity(address(0), ...).
4. Provide a valid signature from attackerAddr for the second checkSignatureValidity(_newMemberAddr, ...).
5. Call addMember; repeat to add unlimited members before the community is created.
**How found:** Code reading of addMember: noticed _communityID is user-supplied and unchecked against communityCount, so _communities[_communityID].owner is address(0); then traced checkSignatureValidity/recoverKey to confirm address(0) can be returned and matches the zero owner.
**Exploitation:** Attacker pre-populates membership of a future community by exploiting the zero-owner signature bypass, gaining member privileges once the community is created.
**Insight:** When a signature check compares recovered signer to a stored owner, check whether that owner can be address(0) (uninitialized mapping entry) and whether the recovery helper can return address(0) on malformed input — the two zeros match and bypass auth.
