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

Dependency Misconfiguration Vulnerability in configureDependencies Function.

Summary

Dependency Misconfiguration Vulnerability in configureDependencies Function.

Vulnerability Details

1) Incorrect Dependency Recording:

  • By assigning dependencies[0] twice, the function overwrites the first dependency ("MONEY") with the second one ("WEAPN"). Consequently, the dependencies array will contain two references to the "WEAPN" keycode and none to the "MONEY" keycode.

2) Missing Dependency:

  • The "MONEY" dependency is not recorded, which means any functionality dependent on "MONEY" will not recognize this dependency and may not function correctly.

3) Inconsistent State:

  • The system expects the dependencies array to correctly represent all dependencies. An incorrect array can lead to an inconsistent state where the modules and policies may not work as intended.

Impact

1) Functionality Issues:

  • The moneyShelf module will not be recognized as a dependency. Any policy or module that relies on moneyShelf will fail to function correctly because it won't be able to establish the necessary connections or permissions.

2) Security Risks:

  • The incorrect dependency registration can lead to security vulnerabilities if critical checks or balances depend on the moneyShelf module. For example, if moneyShelf handles financial transactions or holds funds, its absence from the dependency list might bypass important security checks.

3) Policy Activation Issues:

  • During the policy activation process, the system records dependencies. If these dependencies are incorrect, the policy may not activate properly, leading to further issues down the line when the policy tries to interact with its expected modules.

Example scenario

Consider a scenario where the Laundrette policy needs to interact with both moneyShelf and weaponShelf. If configureDependencies only records weaponShelf as a dependency twice, the following issues can arise:

  • Interactions with moneyShelf Fail: Any function within Laundrette that needs to interact with moneyShelf will fail because the dependency is not registered.

  • Incorrect Policy Permissions: Permissions required to interact with moneyShelf might not be granted, leading to unauthorized access errors or transaction failures.

  • Module Dependent Index Inconsistency: The system maintains an index of which policies depend on which modules. Incorrectly recording dependencies can cause this index to be inaccurate, leading to potential issues in module upgrades or policy deactivations.

Tools Used

Manual review

Recommendations

To avoid these issues, ensure that each dependency is correctly assigned to a unique index in the dependencies array:

function configureDependencies() external override onlyKernel returns (Keycode[] memory dependencies) {
dependencies = new Keycode ;
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
Validated
Assigned finding tags:

Laundrette incorrect dependencies

Support

FAQs

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