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

Incorrect dependency configuration in `Laundrette::configureDependencies` renders `MoneyShelf` unusable

Summary

Laundrette::configureDependencies incorrectly uses the same index for two different dependencies, causing the first dependency to be overwritten. This results in only one dependency being recorded, which can lead to improper configuration and potential malfunction of the contract.

Vulnerability Details

Laundrette::configureDependencies is designed to set up the dependencies for the Laundrette contract. However, it uses the same index (dependencies[0]) for both MONEY and WEAPN dependencies, causing the first dependency to be overwritten by the second. The relevant code is as follows:

function configureDependencies() external override onlyKernel returns (Keycode[] memory dependencies) {
dependencies = new Keycode[](2);
dependencies[0] = toKeycode("MONEY");
moneyShelf = MoneyShelf(getModuleAddress(toKeycode("MONEY")));
// @audit-high same index used
dependencies[0] = toKeycode("WEAPN");
weaponShelf = WeaponShelf(getModuleAddress(toKeycode("WEAPN")));
}

Impact

This vulnerability leads to only one dependency being recorded instead of two, which results in improper configuration of the protocol, where the Laundrette contract may not properly configure its dependencies and the protocol's overall access control.

Tools Used

Manual code review

Recommendations

To resolve this issue, the Laundrette::configureDependencies function should be corrected to use separate indexes for each dependency. Here is the updated implementation:

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
Submission Judgement Published
Invalidated
Reason: Too generic
Assigned finding tags:

Laundrette incorrect dependencies

irondevx Submitter
about 1 year ago
n0kto Lead Judge
about 1 year ago
irondevx Submitter
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.