Skip to content
Access control Audit finding Intermediate

changeOrder requires subcontractor signature when the subcontractor address is 0

The changeOrder function requires a signature from the current subcontractor even when that address is zero, unlike the contractor case where a zero address skips the signature check. An attacker could bypass this by submitting an invalid signature that recovers to address zero, though the report notes this may not be intended.

Lambda Follow

Originally disclosed on Code4rena

Submitted by Lambda

Project.sol#L402 Project.sol#L485

Via changeOrder, it is possible to set the subcontractor address to 0 (and it is zero when no one is invited). However, when it is updated later again, a signature of the “current subcontractor” (in this case address(0)) is still required. This is in contrast to contractors, where the signature is only required when the contractor address is non-zero.

Proof Of Concept

1.) Task 1 is assigned to the subcontractor Bob. 2.) changeOrder with Bob’s signature is used to assign task 1 temporarily to address 0 while a new subcontractor is searched. 3.) The price of the task should be changed, which requires the signature of the “current subcontractor” (i.e., address(0))

To be fair, because SignatureDecoder.recoverKey returns address(0) for invalid signatures, an invalid signature could in theory be submitted in step 3. But I do not assume that this is really intended (for instance, there is also the check in checkSignatureTask, although one could simply use an invalid signature when it is address(0)) and a design that requires the user to submit invalid signatures in certain scenarios would also be very poor in my opinion.

Recommended Mitigation Steps

Check if the subcontractor address is zero, do not require a valid signature in such cases.

parv3213 (Rigor) acknowledged


The original report as published on Code4rena, by Lambda. 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 code does not check for a zero subcontractor address before requiring a signature, unlike the contractor logic.

Impact

An attacker could bypass the signature requirement by submitting an invalid signature that recovers to address zero, though the report notes this may not be intended.

What the attacker needed

Subcontractor set to address zero; ability to call changeOrder

The fix

The code should check if the subcontractor address is zero and not require a valid signature in that case.

How it was found

  1. Task 1 is assigned to the subcontractor Bob.
  2. changeOrder with Bob’s signature is used to assign task 1 temporarily to address 0.
  3. The price of the task is changed, requiring the signature of the current subcontractor (address 0).

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 called changeOrder lets someone update task details. It asks for a signature from the current subcontractor, but if the subcontractor is set to nobody (address zero), it still asks for a signature. Because invalid signatures can also produce address zero, someone could skip the real signature check.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by Lambda

View all

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

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.