Skip to content
Business logic Audit finding Intermediate

Project.changeOrder() would work unexpectedly for non SCConfirmed tasks.

The changeOrder function reverts for tasks without a confirmed subcontractor because it always calls checkSignatureTask, which assumes a confirmed subcontractor. This prevents the project builder and contractor from changing a task's cost until a subcontractor is confirmed.

hansfriese Follow

Originally disclosed on Code4rena

Submitted by hansfriese

Project.sol#L402

The changeOrder() function will revert when it’s called for the tasks that don’t have subcontractors.

As a result, the project builder and contractor can’t change the cost of a task until the subcontractor is confirmed.

Proof of Concept

The changeOrder() is used to change the cost or subcontractor of a task and there is no documentation that this function must be called only after a subcontractor is confirmed.

Also, it’s reasonable to be able to change the cost when a subcontractor isn’t confirmed yet.

But when it checks signature here, it assumes the task has a confirmed subcontractor already and checkSignatureTask() will revert in other cases.

So this function will be useless for non SCConfirmed tasks.

Tools Used

Solidity Visual Developer of VSCode

Recommended Mitigation Steps

We should check separately in case the subcontractor is confirmed or not here.

if (getAlerts(_taskID)[2]) {
    // If subcontractor has confirmed.
    checkSignatureTask(_data, _signature, _taskID);
} else {
    // If subcontractor not has confirmed.
    checkSignature(_data, _signature);
}

parv3213 (Rigor) acknowledged

0xA5DF (warden) commented:

I think this is invalid, since currently checkSignatureTask will pass if SC is the zero address and the signature isn’t a valid signature (i.e. builder and GC can just pass zero as the signature).

This will only be valid if the sponsor fixes other bugs by making checkSignatureValidity() revert on invalid signature.

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

Will downgrade to Medium given this is a feature being malfunctioning.


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

Root cause

Likely the function unconditionally calls checkSignatureTask, which is only valid when a subcontractor is confirmed, instead of branching based on confirmation status.

Impact

The project builder and contractor cannot change the cost of a task until the subcontractor is confirmed, making the function useless for non-confirmed tasks.

What the attacker needed

Task without confirmed subcontractor

The fix

The function should check whether the subcontractor is confirmed and call checkSignatureTask only if confirmed, otherwise call checkSignature.

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 has a function to change a task's cost or subcontractor. It mistakenly requires a subcontractor to be confirmed first, so it fails for tasks without one. This blocks a legitimate action until an unrelated condition is met.

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

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.