Skip to content
Business logic Audit finding Intermediate

Hash approval not possible when contractor == subcontractor

The hash approval feature for checkSignatureTask fails when the same address is both contractor and subcontractor because the approval is deleted on the first check, causing the second check to fail. An attacker could not exploit this directly, but it prevents legitimate use of the feature in that scenario.

Lambda Follow

Originally disclosed on Code4rena

Submitted by Lambda, also found by hansfriese

Project.sol#L859

When a contractor (let’s say Bob) is also a subcontractor (which can be a valid scenario), it is not possible to use the hash approval feature for checkSignatureTask. The first call to checkSignatureValidity will already delete approvedHashes[address(Bob)][_hash], the second call therefore fails.

Note that the same situation would also be possible for builder == contractor, or builder == subcontractor, although those situations are probably less likely to occur.

Recommended Mitigation Steps

Delete the approval only when all checks are done.

parv3213 (Rigor) confirmed


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

The approval is deleted after the first validity check instead of after all checks are complete.

Impact

The hash approval feature cannot be used when contractor and subcontractor are the same address, potentially blocking legitimate task approvals.

What the attacker needed

Contractor == subcontractor

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 a smart contract, a hash approval lets someone pre-approve an action. Here, the approval is removed after the first check, so if the same person needs to be checked twice (as both contractor and subcontractor), the second check fails. This is a logic bug that blocks a valid use case.

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

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.