Creation of token whitelisting proposals can be DOS’d
The token whitelisting proposal function enforces a cap on the number of open proposals, so once that cap is reached no new whitelisting proposals can be created. An attacker or group of users could fill the queue with fake token proposals, blocking genuine tokens from being proposed and disrupting protocol functionality.
falconhoof Follow with josephdara, zhaojie and 6 others
Originally disclosed on Code4rena
Submitted by falconhoof, also found by josephdara, inzinko (1, 2), zhaojie, forgebyola, Rhaydden, J4X, BiasedMerc, jesjupyter, and cats
The creation of token whitelisting proposals isn limited to 5 proposals; after which it is DOS’d until proposals are voted on and finalized.
Vulnerability Details
In proposeTokenWhitelisting() when a proposal is created to whitelist a new token; the ballotId is added to _openBallotsForTokenWhitelisting. There is then a check to ensure that the length of _openBallotsForTokenWhitelisting does not exceed daoConfig.maxPendingTokensForWhitelisting().
Where maxPendingTokensForWhitelisting has been reached, new proposals will not be created for whitelisting tokens. This could happen by accident or by malicious actions on the part of users manipulating the system.
By default maxPendingTokensForWhitelisting is set to 5 but it could be decreased via vote to 3 which would make the issue even more common place.
function proposeTokenWhitelisting( IERC20 token, string calldata tokenIconURL, string calldata description ) external nonReentrant returns (uint256 _ballotID)
{
// SOME CODE
>>> require( _openBallotsForTokenWhitelisting.length() < daoConfig.maxPendingTokensForWhitelisting(), "The maximum number of token whitelisting proposals are already pending" );
// SOME CODE
uint256 ballotID = _possiblyCreateProposal( ballotName, BallotType.WHITELIST_TOKEN, address(token), 0, tokenIconURL, description );
_openBallotsForTokenWhitelisting.add( ballotID );
return ballotID;
}
POC
Add the test function below to DAO.t.sol and run:
```
function test_DOS_TokenWhitelisting() public
{
// declare names; need 4 more to create proposals
address charlie = address( 0x3333 );
address deployer = address( 0x73107dA86708c2DAd0D91388fB057EeE3E2581aF );
address paul = address( 0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496 );
address jim = address( 0x123456789 );
// transfer salt to all 6 for staking and voting
vm.startPrank(address(daoVestingWallet));
salt.transfer(alice, 200000 ether);
salt.transfer(bob, 200000 ether);
salt.transfer(charlie, 200000 ether);
salt.transfer(deployer, 200000 ether);
salt.transfer(paul, 200000 ether);
salt.transfer(jim, 200000 ether);
salt.transfer(address(dao), 1000000 ether);
vm.stopPrank();
// create 6 tokens
IERC20 test = new TestERC20( "TEST", 18 );
IERC20 test1 = new TestERC20( "TEST1", 18 );
IERC20 test2 = new TestERC20( "TEST2", 18 );
IERC20 test3 = new TestERC20( "TEST3", 18 );
IERC20 test4 = new TestERC20( "TEST4", 18 );
IERC20 test5 = new TestERC20( "TEST5", 18 );
// Each user stake SALT and try to create token whitelisting proposal
vm.startPrank(alice);
staking.stakeSALT(100000 ether);
proposals.proposeTokenWhitelisting(test, "url", "description");
vm.stopPrank();
vm.startPrank(bob);
salt.approve( address(staking), type(uint256).max );
staking.stakeSALT(100000 ether);
proposals.proposeTokenWhitelisting(test1, "url", "description");
vm.stopPrank();
vm.startPrank(charlie);
salt.approve( address(staking), type(uint256).max );
staking.stakeSALT(100000 ether);
proposals.proposeTokenWhitelisting(test2, "url", "description");
vm.stopPrank();
vm.startPrank(deployer);
salt.approve( address(staking), type(uint256).max );
staking.stakeSALT(100000 ether);
proposals.proposeTokenWhitelisting(test3, "url", "description");
vm.stopPrank();
vm.startPrank(paul);
salt.approve( address(staking), type(uint256).max );
staking.stakeSALT(100000 ether);
proposals.proposeTokenWhitelisting(test4, "url", "description");
vm.stopPrank();
// jim needs to be granted access
grantAccessTeam();
// 6th proposal fails
vm.startPrank(jim);
salt.approve( address(staking), type(uint256).max );
staking.stakeSALT(100000 ether);
vm.expectRevert("The maximum number of token whitelisting proposals are already pending");
proposals.proposeTokenWhitelisting(test5, "url", "description");
vm.stopPrank();
}
```
Impact
Malicious users can clog the whitelisting queue with fake token proposals, blocking the addition of genuine tokens and DOSing core functionality of the protocol. This can restrict the ability of the protocol to operate and it’s popularity with users. Although a user can only create one proposal per address at a time; a coordinated group of just five could block the functionality indefinitely.
Tools Used
Foundry
Recommendations
Allow a trusted authority to remove proposals which they deem to be malicious such as proposals for fake tokens.
othernet-global (Salty.IO) confirmed, but disagreed with severity and commented:
Make proposals require a percent of the staking SALT which is set by the DAO. Each user can only make one proposal at a time. Additionally, the default unstaking period for xSALT is 52 weeks and xSALT is non-transferrable.
Picodes (Judge) decreased severity to Medium and commented:
Medium severity seems appropriate here under “function of the protocol or its availability could be impacted”.
othernet-global (Salty.IO) commented:
There is now no limit to the number of tokens that can be proposed for whitelisting.
Also, any whitelisting proposal that has reached quorum with sufficient approval votes can be executed.
https://github.com/othernet-global/salty-io/commit/ccf4368fcf1777894417fccd2771456f3eeaa81c
Status: Mitigation confirmed. Full details in reports from zzebra83, 0xpiken, and [t0x1c].
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 contract enforces a hard limit on the number of open token whitelisting proposals, and there is no mechanism for a trusted party to remove malicious or fake proposals to free up slots.
Impact
A coordinated group of just five users could indefinitely block the addition of genuine tokens, disrupting core protocol functionality and its popularity with users.
What the attacker needed
Staked SALT tokens; multiple addresses to create multiple proposals
The fix
The project removed the limit on the number of token whitelisting proposals and allowed any proposal that reached quorum with sufficient approval votes to be executed.
How it was found
- Stake SALT tokens to gain the ability to create proposals.
- Create token whitelisting proposals for fake tokens until the maximum number of pending proposals is reached.
- Attempt to create another token whitelisting proposal and observe that it reverts with an error about the maximum number of pending proposals.
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 smart contract lets people propose new tokens to be added to an approved list. The contract only allows a small number of such proposals to be open at once. If those slots are filled, even with junk proposals, no one else can propose a real token until the existing ones are voted on and closed.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.