Submitted by t0x1c
Inside DAO.sol, _finalizeTokenWhitelisting() before finalizing a token whitelisting proposal makes a check that its the ballot with most votes:
The tokenWhitelistingBallotWithTheMostVotes() function however does not care if the other ballots being looped through are yet not past their deadline. This is an incorrect approach because a ballot which has more Yes votes at this point of time may well turn into a rejected ballot by its deadline timestamp if additional No votes are cast in coming days. Hence using its current state to deny whitelisting of a proposal past its deadline is unfair & only contributes to delaying the timelines, since this may happen again & again which would result in the protocol repeatedly pushing the finalization time further & further away into the future.
Explanation through an example scenario (also provided in the form of a coded PoC in the next section):
This caused a delay of around 11 days in ProposalAs finalization. This works as a good attack vector for a malicious staker who wishes to postpone someones else proposal but does not have enough voting power to defeat it. With some positive votes coming their way from unsuspecting stakers, they can mount this attack. Heres how:
Add the following tests inside src/dao/tests/DAO.t.sol and run via COVERAGE="yes" NETWORK="sep" forge test -vv --rpc-url https://rpc.ankr.com/eth_sepolia --mt test_tokenWhitelistingDelayed to see the test pass:
Foundry
The following diff uses the first option:
othernet-global (Salty.IO) confirmed and commented:
Status: Mitigation confirmed. Full details in reports from 0xpiken, zzebra83, and t0x1c.
