Out of gas.
The smart contract has an unbounded array of collateral tokens that grows with each new collateral added, and no function to reduce its size. As the array grows, the gas cost of calls to getVC() increases, potentially leading to out-of-gas errors or block gas limit issues, which could lock funds.
Submitted by Jujic, also found by gzeon
There is no upper limit on poolColl.tokens[], it increments each time when a new collateral is added. Eventually, as the count of collateral increases, gas cost of smart contract calls will raise and that there is no implemented function to reduce the array size.
Impact
For every call getVC() function which computed contain the VC value of a given collateralAddress is listed in poolColl.tokens[] array, the gas consumption can be more expensive each time that a new collateral address is appended to the array, until reaching an “Out of Gas” error or a “Block Gas Limit” in the worst scenario.
Proof of Concept
Tools Used
Remix
Recommended Mitigation Steps
Array’s length should be checked.
kingyetifinance (Yeti finance) confirmed and disagreed with severity:
@LilYeti: This is a known problem, and we are yet to test the upper limits of the contracts as is. Not sure how more theoretical issues like these are scored, but I would agree with that it is a medium to high risk based on how likely it is to happen * the potential effects. The worst possible outcome is that funds are locked in the protocol because it costs too much gas to do a withdrawal. We are still doing analysis on this, judges do what you want with this information. We would actually recommend it be a severity level 2, but it does have high potential risk.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the lack of a cap on the collateral tokens array and no mechanism to remove entries, causing unbounded growth and increasing gas costs for functions that iterate over it.
Impact
As the array grows, calls to getVC() become more expensive, potentially causing out-of-gas errors or hitting the block gas limit, which could lock funds in the protocol.
What the attacker needed
Many collateral tokens added
The fix
The array's length should be checked, likely by imposing a maximum limit on the number of collateral tokens.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Smart contracts on Ethereum require gas to run, and gas costs increase with the amount of work. Here, a list of collateral tokens can grow forever, making a key function more expensive to call. Eventually, it might become too expensive to call at all, which could trap funds.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.