Submitted by deth, also found by deth, roland, peanuts (1, 2, 3), Aamir, pontifex, 0xHelium, Pechenite, pep7siup, AkshaySrivastav, ast3ros, ayden, 00xSEV, 0xCiphky (1, 2), King_, Tricko (1, 2), fnanni, ABAIKUNANBAEV, y4y, SpicyMeatball, ke1caM, ptsanev, mahdirostami, bart1e, and rvierdiiev
CultureIndex is responsible for the creation, voting and dropping (auctioning off) art pieces.
Lets focus on dropTopVotedPiece . The function is used by the AuctionHouse  to take the top voted art piece, drop it and auction it off.
Notice how the top voted piece is retrieved and then we check if totalVoteWeight > quorumVotes . This is used to check if the piece has reached its quorum, which is cached during creation.
Notice that for quorumVotes we use the erc20VotingToken.totalSupply , erc721VotingToken.totalSupply and quorumVotesBPS.
Knowing all this, a malicious user can do the following to break dropTopVotedPiece  under certain conditions.
He will call ERC20TokenEmitter#buyToken to buy the voting token, which in turn will inflate the erc20VotingToken.totalSupply , which will also increase the newPiece.quorumVotes .
After this he will create a new bogus art piece and its quorum votes will be inflated (We are assuming that no one wants to vote for the art piece as its a bogus/fake art piece).
He will then vote for his new piece, making it the top voted piece, but the piece wont reach its quorum so it cannot be dropped.
At this point one of the following can occur:
All 3 of the scenarios are bad for the normal execution of the protocol and especially under scenario 1, can leave pieces to just rot, as they can never be reached.
Note that the malicious user that does the attack, doesnt lose any funds, as he is just paying to buy the voting token, also the attack scenario can happen on its own naturally, without the use of buyToken , but it will still lead to 1 of the 3 followup scenarios.
This scenario can happen naturally, without anyone being malicious and the attack doesnt rely on the fact that anyone can call buyToken , it just makes it easier.
The sponsor has stated that in the future there will contracts that interface with buyToken , so even if access control is added to the function, it still wont fix the issue.
Create a folder inside revolution/test called CustomTests , create a new file called CustomTests.t.sol , paste the following inside and run forge test --mt testTopVotedPieceCantReachQuorum -vvvv.
Foundry
There isnt a very elegant way to fix this, as this is how a Max Heap is supposed to function. One way is to add an admin function that can forcefully drop a piece from the Max Heap.
rocketman-21 (Revolution) acknowledged and commented:
0xTheC0der (Judge) commented:
rocketman-21 (Revolution) commented:
osmanozdemir1 (Warden) commented:
0xTheC0der (Judge) commented:
