# Vultisig whitelisting can be bypassed by anyone

Vultisig's checkWhitelist treats unset whitelist index (0) as valid, letting any non-whitelisted user buy tokens and bypass the 3 ETH cap.

- Payout: Audit contest
- Severity: high
- Program: Vultisig
- Found by: juancito
- Disclosed: 2024-08-05
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-06-vultisig-findings/issues/42
- Library page: https://bugbountylibrary.com/r/c4%3A2024-06-vultisig%3AH-02
- Tags: area:web3 domain:web3 impact:integrity kind:contest platform:code4rena sev:high tech:evm tech:solidity technique:source-review vuln:access-control vuln:business-logic

**Target:** Solidity Whitelist contract (checkWhitelist)
**Root cause:** checkWhitelist reverts only when _allowedWhitelistIndex==0 or _whitelistIndex[to] > _allowedWhitelistIndex; since unset users have index 0, the comparison 0 > limit never reverts, so non-whitelisted users pass.
**Steps:**
1. Deploy fixture; setVultisig, setLocked(false), setOracle.
2. Confirm checkWhitelist(pool, otherAccount, 0) reverts before limit set.
3. Call setAllowedWhitelistIndex(10).
4. Call checkWhitelist(pool, otherAccount, 0) — now succeeds for non-whitelisted account.
**How found:** Code reading of checkWhitelist: noticed _allowedWhitelistIndex is a max limit, not a flag, and that default _whitelistIndex[to]==0 makes the > comparison always false.
**Exploitation:** Any non-whitelisted account calls the launch/buy path after the allowed index limit is configured; checkWhitelist passes, allowing token purchases and repeated buys across accounts to exceed the 3 ETH per-user cap.
**Escalation:** Use multiple non-whitelisted accounts to bypass per-user 3 ETH limit, distorting price and denying legit whitelisted users.
**Insight:** When a mapping's default value (0) is used as a sentinel, verify every comparison against it; a 'max index' bound check does not prove membership — check for index==0 explicitly.

## Proof of concept (copied exactly from the original report)

**Hardhat test bypassing whitelist**

```
it.only("Bypasses whitelisting", async function () {
    const { owner, whitelist, pool, otherAccount, mockOracleSuccess, mockContract } = await loadFixture(deployWhitelistFixture);

    await whitelist.setVultisig(mockContract);
    await whitelist.setLocked(false);
    await whitelist.setOracle(mockOracleSuccess);

    // `otherAccount` is not whitelisted and can't bypass the whitelist check
    await expect(whitelist.connect(mockContract).checkWhitelist(pool, otherAccount, 0)).to.be.revertedWithCustomError(
    whitelist,
    "NotWhitelisted",
    );

    // Until an `_allowedWhitelistIndex` limit is set
    // This value is intended as a limit, not as a flag not allow non-whitelisted users
    await whitelist.setAllowedWhitelistIndex(10);

    // `otherAccount` and any other user can now bypass the whitelisting
    await whitelist.connect(mockContract).checkWhitelist(pool, otherAccount, 0);
});
```

