In the contract AaveDIVAWrapper.sol
, there is a function for creating contingent pools in batches called AaveDIVAWrapper::batchCreateContingentPool()
which is an external contract which can be called by anyone. The problem lies with the fact that there is no limit to the number of contingent pools one call can create. This can lead to an exploiter calling the function with n
number of PoolParams
values, exhausting the block gas limit and rendering the contract unusable.
I modified an existing test case where this particular function, batchCreateContingentPool()
, was being tested. I increased the number of values in the poolParamsArray
, an array of struct PoolParams
required to create contingent pools, that was passed as a parameter to the function. As suspected, the amount of gas consumed increased significantly with each new value that I added to the array, eventually leading the function to revert.
Here is a snippet of the test case that I ran to find out the amount of gas consumed by the function:
Output:
When I set the length of the array to 5 - Gas used: 4106947
When length = 10 - Gas used: 7931858
When length = 15 - Gas used: 11756825
As you can see, with the increase in the size of the array, the amount of gas consumed increases proportionally.
This vulnerability could lead to the entire contract being rendered as unusable.
Impacted LoC - https://github.com/Cyfrin/2025-01-diva/blob/23cdc88da7e2a9341f453854e876eee82a18e53e/contracts/src/AaveDIVAWrapper.sol#L113
Manual Review
Set a limit to the number of contingent pools that can be created in the batchCreateContingentPools()
function.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.