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

Incorrect return value in `Laundrette.sol::configureDependencies`

Summary

In Laundrette.sol::configureDependencies the returned Keycode[] dependencies array does not return the correct values.

Vulnerability Details

The dependencies[0] array spot is saved to by both toKeycode("MONEY") and toKeycode("WEAPN")

function configureDependencies() external override onlyKernel returns (Keycode[] memory dependencies) {
dependencies = new Keycode[](2);
@> dependencies[0] = toKeycode("MONEY");
moneyShelf = MoneyShelf(getModuleAddress(toKeycode("MONEY")));
@> dependencies[0] = toKeycode("WEAPN");
weaponShelf = WeaponShelf(getModuleAddress(toKeycode("WEAPN")));
}

Impact

This is the current return values:
[0x574541504e000000000000000000000000000000000000000000000000000000, 0x0000000000000000000000000000000000000000000000000000000000000000]

This is what it should return:
[0x4d4f4e4559000000000000000000000000000000000000000000000000000000, 0x574541504e000000000000000000000000000000000000000000000000000000]

Tools Used

--Foundry

Recommendations

It is recommended to use the [1] slot of the dependencies array and set it's value to toKeycode("WEAPN")

function configureDependencies() external override onlyKernel returns (Keycode[] memory dependencies) {
dependencies = new Keycode[](2);
dependencies[0] = toKeycode("MONEY");
moneyShelf = MoneyShelf(getModuleAddress(toKeycode("MONEY")));
- dependencies[0] = toKeycode("WEAPN");
+ dependencies[1] = toKeycode("WEAPN");
weaponShelf = WeaponShelf(getModuleAddress(toKeycode("WEAPN")));
}
Updates

Lead Judging Commences

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

Laundrette incorrect dependencies

Support

FAQs

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