Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbounded iterations over strategies or tokens #111

Open
code423n4 opened this issue Sep 15, 2021 · 1 comment
Open

Unbounded iterations over strategies or tokens #111

code423n4 opened this issue Sep 15, 2021 · 1 comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Warden finding duplicate Another warden found this issue

Comments

@code423n4
Copy link
Contributor

Handle

cmichel

Vulnerability details

Many contracts iterate over the entire strategies or tokens array of a vault

For example:

  • Harvester.removeStrategy
  • Harvester.harvestNextStrategy
  • Manager.removeToken

Impact

The transactions can fail if the arrays get too big and the transaction would consume more gas than the block limit.
This will then result in a denial of service for the desired functionality and break core functionality.

Recommended Mitigation Steps

Keep the number of strategies and tokens per pool small.
Alternatively use an enumerable set for better efficiency. It does not require iterating over the entire array when trying to find an element in removeStrategy/Token.

@code423n4 code423n4 added 1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Warden finding labels Sep 15, 2021
code423n4 added a commit that referenced this issue Sep 15, 2021
@Haz077 Haz077 added the duplicate Another warden found this issue label Sep 27, 2021
@GalloDaSballo
Copy link
Collaborator

Agree with finding, this shows a different exploit that can be mitigated by using OpenZeppelin's EnumerableSet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 (Low Risk) Assets are not at risk. State handling, function incorrect as to spec, issues with comments bug Warden finding duplicate Another warden found this issue
Projects
None yet
Development

No branches or pull requests

3 participants