-
Notifications
You must be signed in to change notification settings - Fork 80
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
C-01 DoS Due to Unrestricted Growth of poolAssets Array #1889
C-01 DoS Due to Unrestricted Growth of poolAssets Array #1889
Conversation
Codecov Report
@@ Coverage Diff @@
## sparrowDom/balancer-composable-st-pool #1889 +/- ##
===========================================================================
- Coverage 67.58% 57.39% -10.19%
===========================================================================
Files 51 51
Lines 2724 2725 +1
Branches 703 704 +1
===========================================================================
- Hits 1841 1564 -277
- Misses 880 1158 +278
Partials 3 3
... and 7 files with indirect coverage changes 📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today! |
@@ -174,6 +174,15 @@ describe("ForkTest: Balancer MetaStablePool rETH/WETH Strategy", function () { | |||
auraRewardPool | |||
); | |||
}); | |||
|
|||
// Un-skip once we re-deploy the strategy | |||
it.skip("Shouldn't be able to cache assets twice", async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How are we going to make sure we do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about like this :)
74fd116
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged. Will fully verify when all changes integrated.
040cd1c
to
74fd116
Compare
ea1c8ef
into
sparrowDom/balancer-composable-st-pool
BaseBalancerStrategy's cachePoolAssets increases the length of poolAssets list with every call, extending the list by the same assets every time. Calling this method more than once will cause DoS via several paths:
Crucially,
cachePoolAssets
lacks access control and as a result, is callable by anyone.Thus, a malicious second call to this function will break the deposit and withdrawal
functionality of all Balancer strategies.
Consider checking that the
poolAssets
array is empty at the beginning ofcachePoolAssets