Skip to content
DoS Audit finding Intermediate

Project.addTasks() wouldn’t work properly when it’s called from disputes contract.

The addTasks function requires the caller-supplied task count to match the current task count, but a dispute resolution can take time during which new tasks are added, causing the dispute resolution call to revert. An attacker could not exploit this directly, but it causes a denial of service for dispute resolution.

hansfriese Follow

Originally disclosed on Code4rena

Submitted by hansfriese, also found by Lambda

Project.sol#L238

addTasks() function checks this require() to make sure _taskCount is correct.

But it might revert when this function is called after a dispute because it takes a certain time to resolve disputes and other tasks might be added meanwhile.

Proof of Concept

The below scenario would be possible.

  • A project contains 10 active tasks(taskCount = 10) and a builder and contractor are going to add one more task.
  • There were some disagreements between a builder and contractor so they raised a dispute with _taskCount = 10 using raiseDispute().
  • Normally it would take a certain time(like 1 day or more) to resolve the dispute as it must be done by HomeFi owner.
  • Meanwhile, if the builder and contractor need to add another task, they should set _taskCount = 10 and taskCount will be 11 after addition here.
  • After that, the HomeFi admin agreed to add a task with _taskCount = 10, but it will revert here.

So currently, the project builder and contractor shouldn’t add new tasks to make their previous dispute valid.

I think it’s reasonable to modify that they can add other tasks even though there is an active dispute.

Tools Used

Solidity Visual Developer of VSCode

Recommended Mitigation Steps

I think we can modify not to compare taskCount when it’s called from disputes contract.

So we can modify this part like below.

if (_msgSender() != disputes) {
    require(_taskCount == taskCount, "Project::!taskCount");
}
else {
    _taskCount = taskCount;
}

parv3213 (Rigor) confirmed


The original report as published on Code4rena, by hansfriese. 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

Impact

The dispute resolution call reverts, preventing the dispute from being resolved until no new tasks are added, effectively blocking dispute resolution.

What the attacker needed

An active dispute; new tasks added during dispute

How it was found

  1. A project has 10 active tasks and a dispute is raised with _taskCount = 10.
  2. While the dispute is pending, the builder and contractor add another task, setting _taskCount = 10 and increasing taskCount to 11.
  3. The HomeFi admin tries to resolve the dispute by calling addTasks with _taskCount = 10, but the require check fails because taskCount is now 11.

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 function checks that the number of tasks passed in matches the current number of tasks. If tasks are added while a dispute is being resolved, the dispute resolution call will fail because the numbers no longer match. This means the dispute cannot be resolved until no new tasks are added.

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.

More by hansfriese

View all

65 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.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.