Skip to content
Business logic Audit finding Intermediate

Task Functionality completely sidestepped via autoWithdraw

The autoWithdraw function sends funds to the builder whenever a task's cost is reduced, allowing a builder to repeatedly create, allocate, and reduce task costs to drain all project funds. This bypasses the task-based logic and trust assumptions of the system.

GalloDaSballo Follow

Originally disclosed on Code4rena

Submitted by GalloDaSballo

Project.sol#L770

autoWithdraw will send funds to the builder, we can use this knowledge to drain all funds from Project to the builder contract. Completely sidestepping the whole Task based logic.

Impact

Through creation and deletion of tasks, leveraging autoWithdraw which will always send the funds to be builder, even when origin was the Community, a builder can cycle out all funds out of the Project Contract and transfer them to themselves.

Ultimately this breaks the trust assumptions and guarantees of the Task System, as the builder can now act as they please, the Project contract no longer holding any funds is limited.

Only aspect that diminishes impact is that the system is based on Credit (uncollateralized /undercollateralized lending), meaning the Builder wouldn’t be “committing a crime” in taking ownership of all funds.

However the system invariants used to offer completely transparent accounting are now bypassed in favour of “trusting the builder”.

Proof of Concept

We know we can trigger autoWithdraw it by creating and allocating a task, and then reducing it’s cost

            // If tasks are already allocated with old cost.
            if (tasks[_taskID].alerts[1]) {
                // If new task cost is less than old task cost.
                if (_newCost < _taskCost) {
                    // Find the difference between old - new.
                    uint256 _withdrawDifference = _taskCost - _newCost;

                    // Reduce this difference from total cost allocated.
                    // As the same task is now allocated with lesser cost.
                    totalAllocated -= _withdrawDifference;

                    // Withdraw the difference back to builder's account.
                    // As this additional amount may not be required by the project.
                    autoWithdraw(_withdrawDifference);
                } else if (totalLent - _totalAllocated >= _newCost - _taskCost) {

To funnel the funds we can:

  • Create a new Task with Cost X (call addTasks)
  • Allocate to it (call allocateFunds)
  • changeOrder to trigger the condition if (_newCost < _taskCost) { and receive the delta of tokens

Repeat until all funds are funneled into the builder wallet.

The reason why the builder can do this is because in all functions involved:

only the builder signature is necessary, meaning the contract is fully trusting the builder

Example Scenario

  • Builder funnels the funds out
  • Builder makes announcement: “Funds are safu, we’ll update once we know what to do next”
  • Builder follows up: “We will use twitter to post updates on the project”
  • Entire system is back to being opaque, making the system pointless

Recommended Mitigation Steps

Below are listed two options for mitigation

  • A) Consider removing autoWithdraw (keep funds inside of project), create a separate multi-sig like way to withdraw
  • B) Keep a split between funds sent by Builder and by Community, and make autoWithdraw send the funds back accordingly (may also need to re-compute total sent in Community)

parv3213 (Rigor) acknowledged and commented:

Users in our system are KYC’ed, whitelisted, and trusted. We are certain that they won’t misuse this feature.

Jack the Pug (judge) decreased severity to Medium and commented:

The issue makes a lot of sense to me, from the security perspective, the system should have as minimal trust as possible. The recommended remediation also makes sense.

I’m not sure about the High severity though. It’s more like a Medium to me.


The original report as published on Code4rena, by GalloDaSballo. 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 autoWithdraw function unconditionally sends the cost difference to the builder when a task's cost is reduced, without verifying the source of funds or enforcing task-based spending limits.

Impact

A builder could drain all funds from the Project contract, breaking the trust assumptions and guarantees of the task system, though the impact is reduced because the system is based on credit and the builder is trusted.

What the attacker needed

Builder role (trusted, KYC'ed)

The fix

The autoWithdraw function should be removed or modified to return funds according to their source (builder or community), and a separate multi-signature withdrawal mechanism should be considered.

How it was found

  1. Create a new task with cost X by calling addTasks.
  2. Allocate funds to the task by calling allocateFunds.
  3. Call changeOrder to reduce the task cost, triggering autoWithdraw and receiving the difference.
  4. Repeat the process until all funds are transferred to the builder.

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 this smart contract, a builder (a trusted user) can create tasks and allocate funds to them. If the builder later reduces a task's cost, the difference is automatically sent back to the builder. By repeating this, the builder can move all the project's money into their own account, even though the system is supposed to keep funds for tasks.

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 GalloDaSballo

View all

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