Beginner FriendlyDeFiFoundry
100 EXP
View results
Submission Details
Severity: low
Valid

Logic flaw in `Laundrette::addToTheGang` function, causing nobody can grant "gangmember" role if GodFather is not a "gangmember"

Description

The function Laundrette::addToTheGang requires caller to be "gangmember" and GodFather at same time. Thus, if the only GodFather is not a "gangmember" (not granted in the first place, or revoked), nobody and grant new "gangmember" roles (even to godfather himself). And this is an dead end.

Impact

If GodFather at this moment is not a "gangmember" (either never granted or revoked), nobody can become "gangmember" anymore.
This is even more dangerous when anyone can revoke others' "gangmember" role.

Proof of Concept

function test_joinGangFail() public {
address alice = makeAddr("alice");
vm.prank(godFather);
vm.expectRevert();
laundrette.addToTheGang(alice);
}

Recommendations

remove onlyRole("gangmember") modifer, and only keep isGodFather:

function addToTheGang(address account) external isGodFather {
Updates

Lead Judging Commences

n0kto Lead Judge about 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

GodFather is not a gang member

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.