A majority attack can steal precious NFT from the party by crafting and chaining two proposals
A majority holder could steal a precious NFT from a party by chaining two proposals: one to fractionalize the NFT into ERC20 tokens and another to transfer those tokens to the attacker, who then redeems them for the NFT. The attack exploits the ability to predict the vault address and execute both proposals before other members can secure the tokens.
Submitted by Trust, also found by ladboy233 and Lambda
Description
The PartyGovernance system has many defenses in place to protect against a majority holder stealing the NFT. Majority cannot exfiltrate the ETH gained from selling precious NFT via any proposal, and it’s impossible to sell NFT for any asset except ETH. If the party were to be compensated via an ERC20 token, majority could pass an ArbitraryCallsProposal to transfer these tokens to an attacker wallet. Unfortunately, FractionalizeProposal is vulnerable to this attack. Attackers could pass two proposals and wait for them to be ready for execution. Firstly, a FractionalizeProposal to fractionalize the NFT and mint totalVotingPower amount of ERC20 tokens of the created vault. Secondly, an ArbitraryCallsProposal to transfer the entire ERC20 token supply to an attacker address. At this point, attacker can call vault.redeem() to burn the outstanding token supply and receive the NFT back.
Impact
A 51% majority could steal the precious NFT from the party and leave it empty.
Proof of Concept
The only non-trivial component of this attack is that the created vault, whose tokens we wish to transfer out, has an undetermined address until VAULT_FACTORY.mint() is called, which creates it. The opcode which creates the vault contract is CREATE, which calculates the address with keccak256(VAULT_FACTORY, nonce). Nonce will keep changing while new, unrelated NFTs are fractionalized. The attack needs to prepare both FractionalizedProposal and ArbitraryCallsProposal ahead of time, so that they could be chained immediately, meaning there would be no time for other members to call distribute() on the party, which would store the fractionalized tokens safely in the distributor. In order to solve this chicken and the egg problem, we will use a technique taken from traditional low-level exploitation called heap feng shui.
Firstly, calculate off-chain, the rate new NFTs are fractionalized, and multiple by a safety factor (like 1.2X), and multiply again by the proposal execution delay. This number, added to the current VAULT_FACTORY nonce, will be our target_nonce. Calculate target_vault = keccak256(VAULT_FACTORY, target_nonce), before_target_vault = keccak256(VAULT_FACTORY, target_nonce-1)
Firstly, we will create a contract which has an attack function that:
- Loop while beforetargetvault != createdvault: • Mint new dummy attackerNFT • createdvault = VAULTFACTORY.mint(attacker_NFT…)
Call execute()on the FractionalizedProposal // We will feed the execute() parameters to the contract in a separate contract setter. Note that this is guaranteed to create target_vault on the correct address.Call execute()on the ArbitraryCallsProposal
Then, we propose the two proposals:
- Propose a FractionalizedProposal, with any list price and the precious NFT as parameter
- Propose an ArbitraryCallsProposal, with target = target_vault, data = transfer(ATTACKER, totalVotingPower)
Then, we set the execute() parameters passed in step 2 and 3 of the attack contract using the proposalID allocated for them.
Then, we wait for execution delay to finish.
Finally, run the attack() function prepared earlier. This will increment the VAULT_FACTORY nonce until it is the one we count on during the ArbitraryCallsProposal. Pass enough gas to be able to burn enough nonces.
At this point, attacker has all the vault tokens, so he may call vault.redeem() and receive the precious NFT.
Recommended Mitigation Steps
- Enforce a minimum cooldown between proposals. This will mitigate additional weaknesses of the proposal structure. Here, this will give users the opportunity to call
distribute()to put the vault tokens safe in distributor. - A specific fix here would be to call
distribute()at the end of FractionalizeProposal so that there is no window to steal the funds.
merklejerk (PartyDAO) confirmed and commented:
Will fix by creating an automatic distribution at the end of a successful fractionalize proposal.
HardlyDifficult (judge) commented:
Agree with High risk - this scenario allows a majority owner to steal from others in the party.
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
Likely, the FractionalizeProposal does not automatically distribute the newly created vault tokens to members, leaving a window where a majority can pass a subsequent proposal to transfer those tokens to themselves.
What the attacker needed
Attacker controls 51% of voting power; Attacker can submit proposals; Attacker can predict vault address
The fix
The fix was to automatically distribute the vault tokens at the end of a successful fractionalize proposal.
How it was found
- Propose a FractionalizeProposal with the precious NFT and a list price.
- Propose an ArbitraryCallsProposal targeting the predicted vault address to transfer all vault tokens to the attacker.
- Deploy an attack contract that mints dummy NFTs until the vault factory nonce reaches the target, then executes both proposals.
- Wait for the proposal execution delay to pass.
- Run the attack function, which creates the vault at the predicted address and executes the proposals.
- Call vault.redeem() to burn the tokens and receive the NFT.
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.
In a group investment pool, a majority of members can normally not steal the valuable item because safeguards exist. However, by creating two proposals in a specific order, a majority can trick the system into giving them all the tokens that represent the item, and then exchange those tokens for the item itself. This lets them take the item while other members lose their share.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.