Skip to content
Access control Audit finding Intermediate

Project.sol and Community.sol have no way to revoke a hash in approvedHashes

The smart contracts Project.sol and Community.sol allow users to approve hashes but provide no function to revoke an approval. An attacker could exploit a mistakenly approved hash to cause loss of funds or access.

0x52 Follow

Originally disclosed on Code4rena

Submitted by 0x52

Community.sol#L501-L506 Project.sol#L108-L115

User is unable to revoke previously approved hash.

Proof of Concept

If user reconsiders or notices something malicious about the hash after signing, they should be able to revoke the hash. For example the user approves a hash only to find out later that the hash has been spoofed and they weren’t approving what they thought they were. To protect themselves the user should be able to revoke approval, otherwise it may lead to loss of funds or access.

Recommended Mitigation Steps

Add the following function:

function revokeHash(bytes32 _hash) external virtual {
    approvedHashes[_msgSender()][_hash] = false;
}

parv3213 (Rigor) disputed and commented:

I do not find it essential to revoke a hash. As off-chain signatures can never be marked as invalid, adding this feature for on-chain signatures makes no sense.


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

A user who approves a spoofed hash cannot revoke it, which may lead to loss of funds or access.

What the attacker needed

User has approved a hash

The fix

Add a revokeHash function that sets approvedHashes[_msgSender()][_hash] to false.

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.

These smart contracts let a user approve a hash (a digital fingerprint) to authorise some action. Once approved, the user cannot cancel that approval, even if they later realise it was a mistake. If an attacker tricks them into approving a malicious hash, the user has no way to undo it, which could lead to lost funds or unauthorised access.

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 0x52

View all

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