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

`godFather` cannot withdraw USDC if he is not given the `gangMember` role during deployment

Description

The Laundrette::withdrawMoney function can only be called by those with the GangMember role only then is checks if the msg.sender is same as the account or godFather
so if godFather is not given the gangMember role during deployment then he cannot use Laundrette::withdrawMoney

Impact

If godFather is not given the gangMember role during deployment then he cannot use Laundrette::withdrawMoney

Proof of Concept

The Laundrette::withdrawMoney checks for gangmember role first

function withdrawMoney(
address account,
address to,
uint256 amount
)
external
@> onlyRole("gangmember")
@> isAuthorizedOrRevert(account)
{
moneyShelf.withdrawUSDC(account, to, amount);
}

Recommended Mitigation

  1. In the Deployer.s.sol's Deployer::deploy function add kernel.grantRole(Role.wrap("gangmember"), godFather); which will give the godFather the GangMember role right from the beginning.

Changes in Deployer.s.sol
function deploy() public returns (Kernel, IERC20, CrimeMoney, WeaponShelf, MoneyShelf, Laundrette) {
godFather = msg.sender;
// Deploy USDC mock
HelperConfig helperConfig = new HelperConfig();
IERC20 usdc = IERC20(helperConfig.getActiveNetworkConfig().usdc);
Kernel kernel = new Kernel();
CrimeMoney crimeMoney = new CrimeMoney(kernel);
WeaponShelf weaponShelf = new WeaponShelf(kernel);
MoneyShelf moneyShelf = new MoneyShelf(kernel, usdc, crimeMoney);
Laundrette laundrette = new Laundrette(kernel);
kernel.grantRole(Role.wrap("moneyshelf"), address(moneyShelf));
+ kernel.grantRole(Role.wrap("gangmember"), godFather);
kernel.executeAction(Actions.InstallModule, address(weaponShelf));
kernel.executeAction(Actions.InstallModule, address(moneyShelf));
kernel.executeAction(Actions.ActivatePolicy, address(laundrette));
kernel.executeAction(Actions.ChangeAdmin, address(laundrette));
kernel.executeAction(Actions.ChangeExecutor, godFather);
return (kernel, usdc, crimeMoney, weaponShelf, moneyShelf, laundrette);
}
  1. Another work around would be for the godFather to change the kernel.admin() to himself and then grant himself the role GangMember and change the admin back to Laundrette

Updates

Lead Judging Commences

n0kto Lead Judge over 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.