Vultisig whitelisting can be bypassed by anyone
The whitelist check in the Vultisig contract incorrectly treats any address with a whitelist index of zero as allowed once a maximum index is set. This lets any non-whitelisted user bypass the whitelist and purchase tokens, also circumventing the 3 ETH limit.
Submitted by juancito, also found by h2134, bbl4de, robertodf99, DanielArmstrong, 4rdiii, Atharv, Mj0ln1r, dvrkzy, Bigsam, 0xrugpull_detector, 0xMAKEOUTHILL, Shahil_Hussain, 0x04bytes, deepkin, Utsav, Nikki, Maroutis, EPSec, kennedy1030, 0xMosh, lionleo, Bob, MrPotatoMagic, leegh, Hendobox, c-note, excalibor, 0xR360, araj, and KupiaSec
Whitelist launch will be bricked. Anyone can buy tokens, and also bypass the 3 ETH limit by buying via other non-whitelisted accounts. This will have an impact on price and ruin the opportunities of legit whitelisted users.
Here’s a diagram on the timelines of the launch. “WL Launch” is the affected phase.
Vulnerability Details
The checkWhitelist() function makes an erroneous check here:
if (_allowedWhitelistIndex == 0 || _whitelistIndex[to] > _allowedWhitelistIndex) {
revert NotWhitelisted();
}
_allowedWhitelistIndex is the max index allowed, and works as a limit, not a whitelist flag. Once it is set (which must happen for all whitelists), any non-whitelisted user can bypass it. This is because _whitelistIndex[to] will be 0, and _whitelistIndex[to] > _allowedWhitelistIndex will never revert (0 > 1000, for example).
Proof of Concept
- Add this test to
/2024-06-vultisig/hardhat-vultisig/test/unit/Whitelist.ts. - Run the test
npx hardhat test.
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);
});
Recommended Mitigation Steps
Prevent non-whitelisted users to bypass the whitelist:
- if (_allowedWhitelistIndex == 0 || _whitelistIndex[to] > _allowedWhitelistIndex) {
+ if (_whitelistIndex[to] == 0 || _whitelistIndex[to] > _allowedWhitelistIndex) {
revert NotWhitelisted();
}
Assessed type
Invalid Validation
wewecalibrate (Vultisig) confirmed
The Warden and its duplicates outline how the whitelist mechanism in the
Whitelist::checkWhitelistfunction is invalid and will treat every user as initialized by default.I consider a high-risk rating to be appropriate given that this represents an egregious error that affects sensitive functionality of the system.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The check uses `_allowedWhitelistIndex == 0` instead of checking whether the user's own index is zero, so a zero index (meaning not whitelisted) passes the condition.
Impact
Any non-whitelisted user could buy tokens during the whitelist launch and bypass the 3 ETH limit, potentially affecting price and denying legitimate whitelisted users.
What the attacker needed
Whitelist launch phase active; allowed whitelist index set to non-zero
The fix
The check should test whether the user's own whitelist index is zero, not whether the allowed index is zero.
How it was found
- Deploy the whitelist fixture and set the Vultisig contract, unlock it, and set the oracle.
- Confirm that a non-whitelisted account is rejected before any allowed index is set.
- Set the allowed whitelist index to a non-zero value.
- Call checkWhitelist for the same non-whitelisted account and observe it succeeds.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A whitelist is a list of approved buyers. The contract meant to block people not on the list, but a mistake in the check let anyone through once a limit was set. So anyone could buy tokens early, not just approved users.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.