Skip to content
Business logic Audit finding Intermediate

Bad redirects can make it impossible to deposit & withdraw

The GatewayVault contract allows a misconfigured redirects array to zero out all deposit amounts, preventing users from depositing or withdrawing. An attacker or misconfiguration could cause a denial of service by setting redirects that clear all vault balances.

cmichel Follow

Originally disclosed on Code4rena

Submitted by cmichel

The GatewayVault._push() function gets redirects from the strategyParams. If redirects[i] = j, vault index i’s deposits are redirected to vault index j.

Note that the deposits for vault index i are cleared, as they are redirected:

for (uint256 j = 0; j < _vaultTokens.length; j++) {
    uint256 vaultIndex = _subvaultNftsIndex[strategyParams.redirects[i]];
    amountsByVault[vaultIndex][j] += amountsByVault[i][j];
    amountsByVault[i][j] = 0;
}

The same is true for withdrawals in the _pull function. Users might not be able to withdraw this way.

If the redirects array is misconfigured, it’s possible that all amountsByVault are set to zero. For example, if 0 redirects to 1 and 1 redirects to 0. Or 0 redirects to itself, etc. There are many misconfigurations that can lead to not being able to deposit to the pool anymore.

Recommended Mitigation Steps

The redirects[i] = j matrix needs to be restricted. If i is redirected to j, j may not redirect itself. Check for this when setting the redirects array.

0xleastwood (judge) commented:

Can you confirm if this issue is valid or not? @MihanixA

MihanixA (Mellow Protocol) confirmed:

@0xleastwood Confirmed

MihanixA (Mellow Protocol) commented:

(notice that this one is a deploy-related issue)

The original report as published on Code4rena, by cmichel. Images and videos are our own copies; raw HTML is shown as text. View it on Code4rena.

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 redirects array is not validated to prevent cycles or self-redirects, allowing deposits to be zeroed out.

Impact

Users may be unable to deposit or withdraw funds from the vault, causing a denial of service.

What the attacker needed

Misconfigured redirects array; deploy-related issue

The fix

The redirects array should be restricted so that if i redirects to j, j cannot redirect itself, and this should be checked when setting the array.

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.

This is a smart contract bug where a setting called 'redirects' can be set up wrongly. If two vaults point to each other, the code clears out all the money records, so users can't put in or take out their funds. It's like a bank ledger that gets erased because of a bad instruction.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by cmichel

View all

196 more disclosed reports, best first.

More from Mellow Protocol contest

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.