Skip to content
Business logic Audit finding Intermediate

Project.raiseDispute() doesn’t use approvedHashes - meaning users who use contracts can’t raise disputes

The raiseDispute function does not check the approvedHashes mechanism that the sponsors added to support users interacting through contracts such as multisig wallets. As a result, those users cannot raise a dispute at all.

0xA5DF Follow

Originally disclosed on Code4rena

Submitted by 0xA5DF

Project.sol#L493-L536

In case users are using a contract (like a multisig wallet) to interact with a project, they can’t raise a dispute.

The sponsors have added the approveHash() function to support users who wish to use contracts as builder/GC/SC. However, the Project.raiseDispute() function doesn’t check them, meaning if any of those users wish to raise a dispute they can’t do it.

Proof of Concept

I’ve modified the following test, trying to use an approved hash. The test failed.

  it('Builder can raise addTasks() dispute', async () => {
      let expected = 2;
      const actionValues = [
        [exampleHash],
        [100000000000],
        expected,
        projectAddress,
      ];
      // build and raise dispute transaction
      const [encodedData, signature] = await makeDispute(
        projectAddress,
        0,
        1,
        actionValues,
        signers[0],
        '0x4222',
      );
      const encodedMsgHash = ethers.utils.keccak256(encodedData);
      await project.connect(signers[0]).approveHash(encodedMsgHash);
      let tx = await project
        .connect(signers[1])
        .raiseDispute(encodedData, "0x");
      // expect event
      await expect(tx)
        .to.emit(disputesContract, 'DisputeRaised')
        .withArgs(1, '0x4222');
      // expect dispute raise to store info
      const _dispute = await disputesContract.disputes(1);
      const decodedAction = abiCoder.decode(types.taskAdd, _dispute.actionData);
      expect(_dispute.status).to.be.equal(1);
      expect(_dispute.taskID).to.be.equal(0);
      expect(decodedAction[0][0]).to.be.equal(exampleHash);
      expect(decodedAction[1][0]).to.be.equal(100000000000);
      expect(decodedAction[2]).to.be.equal(expected);
      expect(decodedAction[3]).to.be.equal(projectAddress);
      // expect unchanged number of tasks
      let taskCount = await project.taskCount();
      expect(taskCount).to.be.equal(expected);
    });

Recommended Mitigation Steps

Make raiseDispute() to check for approvedHashes too.

parv3213 (Rigor) confirmed

Jack the Pug (judge) commented:

Very nice!


The original report as published on Code4rena, by 0xA5DF. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 raiseDispute function only accepts a direct signature and never consults the approvedHashes mapping that other functions use for contract-based users.

Impact

Users who interact through contracts such as multisig wallets cannot raise disputes, so a legitimate action is blocked for them.

What the attacker needed

User acts through a contract wallet; hash approved via approveHash

How it was found

  1. Build and sign a dispute transaction for a builder action.
  2. Compute the hash of the encoded dispute data.
  3. Approve that hash from the contract-based account.
  4. Call raiseDispute with the encoded data and an empty signature.
  5. Observe that the dispute is not raised and the test fails.

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.

Some users do not act directly but through a smart contract, such as a wallet that needs several people to approve a payment. The project added a way for those users to pre-approve an action, but the dispute function ignores that approval, so the action is rejected. The result is a feature that simply does not work for that group of users.

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.

More by 0xA5DF

View all

35 more disclosed reports, best first.

More from Rigor Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.